avue-crud 列配置持久化

关于avue-crud 列配置持久化,和官网一模一样的代码,没有效果,有朋友知道为什么吗?有哪里会影响它?avue版本2.8.26
localStorage打印也是有的,只不过保存配置前后没有变化。

img

<template>
<avue-crud :defaults.sync="defaults" ref="crud"  :option="option" :data="data">
  <template slot="menuLeft" slot-scope="{size}">
    <el-button @click="saveOption" type="danger" :size="size">保存配置</el-button>
  </template>
</avue-crud>
</template>
<script>
let key = 'avue-column';
export default {
  data(){
    return {
      name: 'avue-column',
       defaults:{},
       data:[{
          text1:'内容1-1',
          text2:'内容1-2'
       },{
          text1:'内容2-1',
          text2:'内容2-2'
       },{
          text1:'内容3-1',
          text2:'内容3-2'
       },{
          text1:'内容4-1',
          text2:'内容4-2'
       },{
          text1:'内容5-1',
          text2:'内容5-2'
       }],
       option:{
          sortable:true,
          addBtn:false,
          menu:false,
          border:true,
          align:'center',
          column: [{
            label: '列内容1',
            prop: 'text1',
            hide:false
          }, {
            label: '列内容2',
            prop: 'text2',
            hide:false
          }]
       }
    }
  },
  mounted(){
    this.$nextTick(()=>{
      this.defaults = JSON.parse(localStorage.getItem(key))
    })
    //console.log(window.localStorage)
  },
  methods:{
    saveOption(){
      localStorage.setItem(key,JSON.stringify(this.defaults))
      this.$message.success('配置保存成功')
    }
  }
}
</script>

你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答


本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。


因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。