1. 程式人生 > >Element-Ui元件(二十三)Tag 標籤

Element-Ui元件(二十三)Tag 標籤

export default { data() { return { dynamicTags: ['標籤一', '標籤二', '標籤三'], inputVisible: false, inputValue: '' }; }, methods: { handleClose(tag) { this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1); }, showInput() { this
.inputVisible = true; this.$nextTick(_ => { this.$refs.saveTagInput.$refs.input.focus(); }); }, handleInputConfirm() { let inputValue = this.inputValue; if (inputValue) { this.dynamicTags.push(inputValue); } this.inputVisible = false
; this.inputValue = ''; } } }