<p>需要将getChangeValue函数定义在组件的methods对象中,然后可以通过调用this.getChangeValue来获取选择器的值。代码修改如下:</p>
<p>&lt;n-space vertical :cols=&quot;1&quot; @change=&quot;getChangeValue&quot; @cancel=&quot;$emit('update:show', false)&quot;&gt;
<n-select v-model:value="value" :options="versionList"/>
</n-space></p>
<script>
export default {
  data() {
    return {
      value: '',
      versionList: ['v1.0', 'v2.0', 'v3.0']
    }
  },
  methods: {
    getChangeValue(value) {
      console.log(value)
    }
  }
}
</script>
naiveUi 如何获取选择器的值在下述代码中修改 n-space vertical cols=1 change=getChangeValue cancel=$emitupdateshow false n-select v-modelvalue=value options=versionList n-spaceconst getChangeValue = value =

原文地址: http://www.cveoy.top/t/topic/chCK 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录