Tencent / wepy

小程序组件化开发框架
https://wepyjs.gitee.io/wepy-docs/
Other
22.54k stars 3.05k forks source link

wepy2.x 数组push不能正常更新视图 #2482

Open zsh3384027 opened 5 years ago

zsh3384027 commented 5 years ago

环境

Reproduce

<div v-for="(item, index) in textTemp" :key="index">
      {{item}}
    </div>
    <button @tap="addText">add</button>
data: {
   textTemp: []
}

methods: {
   addText(e) {
      console.log(`add text ${e.$wx.timeStamp}`)
      this.textTemp.push(e.$wx.timeStamp)
    }
}

Observed Results

textTemp还是空数组,视图也不能正常刷新

Expected Results

视图更够正常刷新并显示

但是可以通过以下方式才能刷新数据和视图

  addText(e) {
      console.log(`add text ${e.$wx.timeStamp}`)
      let texts = [...this.textTemp, e.$wx.timeStamp] 
      // this.textTemp.push(e.$wx.timeStamp)
      this.textTemp = texts
    }
nishino-tsukasa commented 4 years ago

引入了第三方插件没

zsh3384027 commented 4 years ago

"dependencies": { "@wepy/core": "^2.0.0-alpha.12", "@wepy/x": "^2.0.3", "md5": "^2.2.1", "vant-weapp": "^0.5.22" }, "devDependencies": { "@babel/core": "^7.1.0", "@babel/preset-env": "^7.1.0", "@wepy/babel-plugin-import-regenerator": "0.0.2", "@wepy/cli": "^2.0.0-alpha.22", "@wepy/compiler-babel": "^2.0.1", "@wepy/compiler-less": "^2.0.1", "babel-eslint": "^7.2.1", "cross-env": "^5.1.3", "eslint": "^3.18.0", "eslint-config-standard": "^7.1.0", "eslint-friendly-formatter": "^2.0.7", "eslint-plugin-html": "^2.0.1", "eslint-plugin-promise": "^3.5.0", "eslint-plugin-standard": "^2.0.1", "less": "^3.8.1", "wepy-eslint": "^1.5.3" }

zsh3384027 commented 4 years ago

引入了第三方插件没

依赖情况,已经贴出来了。应该没有引入你说的第三方插件吧

nishino-tsukasa commented 4 years ago

@zsh3384027 不是这个,我指的是比如腾讯视频、腾讯地图 https://developers.weixin.qq.com/community/servicemarket 这里的插件

zsh3384027 commented 4 years ago

有个腾讯位置服务路线规划插件

nishino-tsukasa commented 4 years ago

@Gcaufy 应该还是那个原因,proto 不能被劫持