vue3 watch监听

新手上路,请多包涵
setup(props) {
    let currentComponent = ref('h5_malljieshao')
    watch(() => props.mainData, newVal => {
      currentComponent = newVal.name + newVal.value;
    })
    return {
      currentComponent
    }
  },

有人知道为什么currentComponent没有跟着变化吗

阅读 1.6k
1 个回答

真的不用currentComponent.value = newVal.name + newVal.value吗

推荐问题