警告
Extraneous non-props attributes (id) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.
原因
使用uni.navigateTo()跳转页面的同时进行传参
uni.navigateTo({
url: `/pages/dev-info/dev-info?title=${dev.Name }&id=${dev.ID}`
})
在/pages/dev-info/dev-info
页面接收参数时,直接定义一个变量进行接收
<script setup>
const curDev = ref({
title: '',
id: ''
})
onLoad((option) => {
console.log('option', option)
curDev.value = option
})
</script>
解决
直接使用defineProps接收参数就可以了
<script setup>
const props = defineProps({
title: {
type: String,
},
id: {
type: String,
}
})
</script>