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

gdrx4gfi  于 2022-10-22  发布在  其他
关注(0)|答案(6)|浏览(169)

环境

  • Platform: 开发者工具
  • Platform version: 1.02.1910120
  • Wechat version:
  • wepy-cli version: 2.0.0-alpha.20
  • wepy version: 2.0.0-alpha.11

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
    }
c86crjj0

c86crjj01#

引入了第三方插件没

z9ju0rcb

z9ju0rcb2#

"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"
}

jei2mxaa

jei2mxaa3#

引入了第三方插件没

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

yruzcnhs

yruzcnhs4#

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

ttygqcqt

ttygqcqt5#

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

5jvtdoz2

5jvtdoz26#

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

相关问题