为了账号安全,请及时绑定邮箱和手机立即绑定

vue在computed中使用$nextTick方法无法动态更新dom

vue在computed中使用$nextTick方法无法动态更新dom

慕桂英4014372 2018-09-17 12:18:26
正在做自己的个人网站,需要通过url参数的变化来动态更新页面内容,根据教程写了这样的代码,但却达不到想要的效果。vue框架是1.0版本的,在项目中使用了vue-router和vue-infinite-loading代码如下:  computed: {     tagId: {      get: function () {        return this.$route.params.tag       },      set: function () {        this.list = []        this.$nextTick(() => {                 this.$broadcast('$InfiniteLoading:reset')         })       }     }   },   methods: {     onInfinite () {           this.$http.get('artical-list/tag/' + this.tagId + '/page/' + (this.list.length / 10 + 1)).then((res) => {             if (res.data.length) {          this.list = this.list.concat(res.data)               this.$broadcast('$InfiniteLoading:loaded')         } else {          this.$broadcast('$InfiniteLoading:complete')         }       })     }   }求解,谢谢!附:vue-infinite-loading的文档:https://peachscript.github.io...!/getting-started/with-filter
查看完整描述

1 回答

?
万千封印

TA贡献1891条经验 获得超3个赞

set函数少了一个参数,这部分代码没有看出tagId有修改过


查看完整回答
反对 回复 2018-10-22
  • 1 回答
  • 0 关注
  • 2309 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信