Unverified Commit ae6eae0c authored by Nicolas Widart's avatar Nicolas Widart Committed by GitHub

Merge pull request #617 from mikemand/feature/allow-tags-default-select

Allow first tag to be selected on enter key
parents f28092b1 bb7fa978
<template>
<el-form-item label="Tags">
<el-select v-model="tags" multiple filterable allow-create remote @change="triggerEvent">
<el-form-item :label="label">
<el-select v-model="tags" multiple filterable allow-create remote default-first-option @change="triggerEvent">
<el-option v-for="tag in availableTags"
:key="tag.slug"
:label="tag.slug"
:value="tag.name">
</el-option>
:value="tag.name"
></el-option>
</el-select>
</el-form-item>
</template>
<script>
import axios from 'axios'
import axios from 'axios';
export default {
props: {
namespace: {String},
currentTags: {default : null},
namespace: { type: String },
label: { type: String, default: 'Tags' },
currentTags: { default: null },
},
data() {
return {
tags: {},
availableTags: {},
}
};
},
methods: {
triggerEvent() {
this.$emit('input', this.tags);
}
},
},
watch: {
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 => {
this.availableTags = response.data;
});
}
}
},
};
</script>
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