vue3父子组件传参能在页面看见数据不能在script标签中输出

74 阅读1分钟

vue3父子组件传参能在页面看见数据不能在script标签中输出

解决办法

const props = defineProps(['fileList'])
watch(
  () => props.fileList,
  () => {
    console.log(props.fileList)
    })

如果还不能输出,看我放大招了

const props = defineProps(['fileList'])
watch(
  () => props.fileList,
  () => {
    console.log(props.fileList)
    },{ deep: true, immediate: true })

深度监听对页面不显示也有用哦