import slider from './slider'
export default {
el: '#slider',
data () {
return {
someList:[
{
title: 'slide1',
img: 'testimg-1.jpg',
},
{
title: 'slide2',
img: 'testimg-2.jpg',
},
{
title: 'slide3',
img: 'testimg-3.jpg',
}
],
sliderinit: {
currentPage: 0,
contentWidth:500,
start: {},
end: {},
tracking: false,
thresholdTime: 500,
thresholdDistance: 100,
}
}
},
components: {
slider
},
methods: {
appendslider(){
this.someList.push({title: 'slidenew',img: 'testimg-4.jpg',});
console.log(this.someList);
}
},
}
示例代码如上,如何通过methods里push的方法,动态添加值到someList里面,并触发子组件里更新数据?目前push只添加了值,没触发更新