Renaming method and watch on current tags prop

parent f3dfa3f8
<template> <template>
<el-form-item label="Tags"> <el-form-item label="Tags">
<el-select v-model="tags" multiple filterable allow-create @change="doSomething"> <el-select v-model="tags" multiple filterable allow-create @change="triggerEvent">
<el-option v-for="tag in availableTags" <el-option v-for="tag in availableTags"
:key="tag.slug" :key="tag.slug"
:label="tag.slug" :label="tag.slug"
...@@ -25,14 +25,16 @@ ...@@ -25,14 +25,16 @@
} }
}, },
methods: { methods: {
doSomething() { triggerEvent() {
this.$emit('input', this.tags); this.$emit('input', this.tags);
} }
}, },
mounted() { watch: {
console.log(this.currentTags); currentTags: function () {
if (this.currentTags !== null) { this.tags = this.currentTags;
} }
},
mounted() {
axios.get(route('api.tag.tag.by-namespace', {namespace: this.namespace})) axios.get(route('api.tag.tag.by-namespace', {namespace: this.namespace}))
.then(response => { .then(response => {
this.availableTags = response.data; this.availableTags = response.data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment