У меня есть входные теги, данные которых разделены запятыми (,), и на странице редактирования я хотел бы показать каждый из них по отдельности. (отдельно от запятой) '
Образец
data
here, goes, testing,tags,check,this,out
current result
What I want it to be
Код
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);
});
},
Любая идея?
Обновление
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);
});
},
}
}