2019-12-04 18:17:25 +08:00
|
|
|
# Custom Input Element
|
2019-12-04 17:59:38 +08:00
|
|
|
```html
|
|
|
|
<n-auto-complete :options="options" v-model="value">
|
|
|
|
<template v-slot:activator="{ handleInput, handleBlur, handleFocus, value }">
|
|
|
|
<n-input
|
|
|
|
type="textarea"
|
|
|
|
@input="handleInput"
|
|
|
|
@focus="handleFocus"
|
|
|
|
@blur="handleBlur"
|
|
|
|
:value="value"
|
|
|
|
placeholder="Email"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</n-auto-complete>
|
|
|
|
```
|
|
|
|
```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: ''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|