Vue3新特性defineModel在Nuxt3中的实现

在nuxt.config.ts中配置

vite: {
    vue: {
      script: {
        defineModel: true,
        propsDestructure: true,
      }
    }
  },

然后在子组件中使用

const paginationIndex = defineModel()

在父组件中使用



父组件可以使用watch来监听子组件修改之后的值,可以做出相应的操作,不得不说defineModel真是太好用了!!!!

顺便帮我怎么传对象结构啊???求助!!!

你可能感兴趣的:(前端,vue.js,前端框架,typescript)