naive-ui/demo/documentation/components/autoComplete/zhCN/basic.md
2020-02-07 23:40:07 +08:00

476 B

基础用法

<n-auto-complete :options="options" v-model="value" placeholder="邮箱" />
export default {
  computed: {
    options () {
      return [
        '@gmail.com',
        '@163.com',
        '@qq.com'
      ].map(suffix => {
        const prefix = this.value.split('@')[0]
        return {
          label: prefix + suffix,
          value: prefix + suffix,
        }
      })
    }
  },
  data () {
    return {
      value: ''
    }
  }
}