uni-app+vue3 获取路由传递的参数
uni-app+vue3 获取路由传递的参数
·
<script lang="ts">
export default {
data() {
return {
id: '',
}
},
onLoad(payload: any) {
const that=this
that.id = payload.id
},
}
</script>
<script lang="ts" setup>
import { reactive, onMounted, ref, onBeforeMount, getCurrentInstance } from 'vue'
let data = reactive<any>({
id: '',
})
onBeforeMount(() => {
data.id = (getCurrentInstance() as any).data.id
})
onMounted(() => {
// console.log(data.id)
})
</script>
更多推荐
已为社区贡献2条内容
所有评论(0)