naive-ui/demo/documentation/components/autoComplete/zhCN/group.md
2020-03-15 18:20:37 +08:00

534 B

成组

<n-auto-complete :options="options" v-model="value" placeholder="邮箱" />
export default {
  computed: {
    options () {
      return [
        ['谷歌', '@gmail.com'],
        ['网易', '@163.com'],
        ['腾讯', '@qq.com']
      ].map(emailInfo => {
        return {
          type: 'group',
          name: emailInfo[0],
          children: [
            this.value.split('@')[0] + emailInfo[1]
          ]
        }
      })
    }
  },
  data () {
    return {
      value: ''
    }
  }
}