naive-ui/demo/documentation/components/auto-complete/enUS/group.demo.md
2020-12-12 15:33:41 +08:00

520 B

Group

<n-auto-complete :options="options" v-model:value="value" placeholder="Email" />
export default {
  computed: {
    options () {
      return [
        ['Google', '@gmail.com'],
        ['Netease', '@163.com'],
        ['Tencent', '@qq.com']
      ].map((emailInfo) => {
        return {
          type: 'group',
          name: emailInfo[0],
          children: [this.value.split('@')[0] + emailInfo[1]]
        }
      })
    }
  },
  data () {
    return {
      value: ''
    }
  }
}