uniapp vue3.x <script setup> 页面传参取值
uniapp vue3.x<script setup>页面传参方式
·
页面a:
uni.navigateTo({
url:"/pages/xx/index?id=1"
})
页面b(接收)
<script>
export default {
data() {
return {
_id: ''
}
},
onLoad(e) {
this._id = e.id;
}
}
</script>
<script setup>
import {
ref,
getCurrentInstance,
onBeforeMount,
} from 'vue'
const id=ref('');
onBeforeMount(()=>{
id.value=getCurrentInstance().data._id;
})
</script>
查了下uniapp文档没有这方面描述,暂时可以使用这种混合取值方式,期待官方更新
更多推荐
已为社区贡献3条内容
所有评论(0)