Element-Ui元件(二十三)Tag 標籤
阿新 • • 發佈:2019-02-12
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 = '';
}
}
}