vue3 视图更新延迟问题
问题描述 [问题描述:尽可能简洁清晰地把问题描述清楚]
复现步骤 [复现问题的步骤]
- 启动 'npm run dev:mp-weixin'
- 点击 '按钮'
- 查看
[或者可以直接贴源代码]
<template>
<view class="title">
{{ count }}
</view>
<button @click="count++">
increment
</button>
<button @click="count--">
decrement
</button>
</template>
<script setup lang="ts">
const count = ref(0)
</script>
<style scoped lang="scss">
.title {
font-size: 32px;
text-align: center;
}
button {
padding: 10px;
margin-top: 20px;
}
</style>
预期结果 实时更新 count
实际结果 有延迟
https://user-images.githubusercontent.com/4394948/156993098-3209ef50-ef7f-49ad-b0c3-fb3a351c56d2.mp4
系统信息:
- 发行平台: 微信小程序
- 操作系统: 安卓
- 版本: 3.0.0-alpha-3040020220301003
https://github.com/dcloudio/uni-app/issues/3305 https://github.com/dcloudio/uni-app/issues/3228 https://ask.dcloud.net.cn/question/140539
已修复,cli更新至:3.0.0-alpha-3040120220307001
已修复,cli更新至:3.0.0-alpha-3040120220307001
3.0.0-alpha-3040120220307001 编译到小程序,真机预览还是有卡顿的现象,没法达到跟手的交互。有几率可以跟手
https://user-images.githubusercontent.com/28776735/157352957-f7fa7e70-ff81-4ad6-a460-a52fab12f2e8.mp4

已修复,cli更新至:3.0.0-alpha-3040120220307001
3.0.0-alpha-3040120220307001 编译到小程序,真机预览还是有卡顿的现象,没法达到跟手的交互。有几率可以跟手
WeChat_20220309090713.mp4
发测试工程
找到问题代码了 视图里边有权限判断,用户的权限存在了Storage里边,没有放到vuex 由于频繁的读取wx.getStorageSync,所以卡顿 vue2版本没有这个问题,vue3不行