Метод splice() изменяет содержимое массива, удаляя существующие элементы и/или добавляя новые.
result = home .map(function(item) {
return item.homeName;
})
result = home.find(function(item) {
return item._id === id
}) || -1;
У меня так:
...
{path: '/templates', component: require('./components/Templates.vue')},
{path: '/templates/:id',
component: require('./components/Template.vue'),
props: true
},
...
export default {
name: 'template',
data: function () {
return {
///
};
},
props: [
'id'
],
watch: {
id: function() {
this.loadTemplate();
}
},
mounted: function () {
this.loadTemplate();
},
methods: {
...