naive-ui/demo/documentation/components/autoComplete/enUS/basic.md
2019-12-04 17:59:38 +08:00

467 B

Basic

<n-auto-complete :options="options" v-model="value" placeholder="Email" />
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: ''
    }
  }
}