使用elementUI级联选择器,懒加载后修改列表数据,当前展示的数据如何实时改变?

问题:
elementUI版本是2.11, 当级联选择器懒加载后,马上修改数据当前列表不会实时更新

代码:

 <template>
  <div>
    <el-button @click="editorCategory" :disabled="canUserButton">编辑</el-button>
    <el-cascader-panel :options="options2" :props="newMethod">
      <template slot-scope="{ node, data }">
        <span style="display: inline-block; width: 100%"  @click="detailNode(node)">{{ data.label }}</span>
      </template>
    </el-cascader-panel>
  </div>
</template>

<script>
  export default {
    data () {
      return {
        props: {
          value: 'id',
          children: 'children'
        },
        newMethod: {
          lazy: true,
          lazyLoad (node, resolve) {
            console.log(node)
            if (!node.data) {
              return
            }
            if (node.data) {
              self.getChildLevel(node.data.id).then(() => {
                resolve(self.childData)
              })
            }
          }
        }
      }
    },
    methods: {
      editorCategoryConfirm (val) {
        this.fullscreenLoading = true
        updateCategory(val).then((res) => {
          this.fullscreenLoading = false
          console.log(res)
          if (res.data.code === 2001) {
          this.$alert(res.data.message, '警告', {
            confirmButtonText: '确定',
            type: 'warning',
            customClass: 'sysUserBox'
          })
        } else {
            this.$alert(res.data.message, '通知', {
              confirmButtonText: '确定',
              type: 'success',
              customClass: 'sysUserBox',
              callback: () => {
              }
            })
          }
        })
      },
    }
  }
</script>

数据懒加载后我进行新增、删除、编辑操作,如何才能改变已经懒加载的数据?

我自己的思路是数据操作后,再调一次lazyLoady函数对之前懒加载的数据进行覆盖,但是我不知道如何操作,希望能帮助我谢谢

阅读 6.1k
1 个回答
新手上路,请多包涵

你可以选择用v-if重新加载一下el-cascader这个组件,这样里面的数据就干净了

推荐问题