I have tags input which the data are separated by commas (,) and in edit page i'd like to show each of them separably. (separate based on comma's)'
Sample
data
here, goes, testing,tags,check,this,out
current result
What I want it to be
Code
fetchData() {
axios
.get('/api/admin/settings/'+this.$route.params.id, {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('access_token')
}
})
.then(response => {
this.form.tags.push(response.data.seo.tags) // here is my data returning to input (image #1)
})
.catch(function (error) {
console.log('error', error);
});
},
any idea?
Update
html
<el-form-item label="SEO Tags">
<el-select
style="width:100%"
v-model="form.tags"
multiple
filterable
allow-create
default-first-option
placeholder="Please input your seo tags (type + hit enter)">
</el-select>
</el-form-item>
script
export default {
data() {
return {
dialogImageUrl: '',
dialogVisible: false,
site_url: process.env.MIX_APP_URL,
form: {
name: '',
tagline: '',
logo: '',
favicon: '',
title: '',
tags: [],
description: '',
photo: '',
_method: 'PUT',
},
}
},
created () {
this.fetchData()
},
methods: {
fetchData() {
axios
.get('/api/admin/settings/'+this.$route.params.id, {
headers: {
Authorization: 'Bearer ' + localStorage.getItem('access_token')
}
})
.then(response => {
this.form.tags.push(response.data.seo.tags) // here is my data returning to input (image #1)
})
.catch(function (error) {
console.log('error', error);
});
},
}
}

