mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +08:00
741 B
741 B
Custom Input Element
<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>
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: ''
}
}
}