如下源码会导致 v-show 失效:
<template>
<view>
<view class="dialog_nav" :style="'top:' + navH + 'rpx;'" v-show="currentPage">
<text>内容</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
navH: 100,
currentPage: false
};
}
};
</script>
如下代码符合预期:
<template>
<view>
<view class="dialog_nav" :style="{ top: `${navH}rpx` }" v-show="currentPage">
<text>内容</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
navH: 100,
currentPage: false
};
}
};
</script>
1 个回复
DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信
我使用下面代码,运行到 vue3 + HBuilderX 4.87 点击按钮,弹窗切换正常