naive-ui/demo/documentation/components/autoComplete/zhCN/basic.md

29 lines
476 B
Markdown
Raw Normal View History

2020-02-07 23:40:07 +08:00
# 基础用法
2020-01-12 00:54:50 +08:00
```html
<n-auto-complete :options="options" v-model="value" placeholder="邮箱" />
```
```js
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: ''
}
}
}
```