页面有一个开关,用的vue switch 开关组件,在谷歌浏览器可以,火狐就不兼容,在火狐下报错‘event is not defined’
Vue.component('t-switch', {
props: {
itemData: {
type: Object,
default: function () {
return {
}
}
}
},
template: `<div class='switch switch-inline' style='height: 20px'>
<input type='checkbox' v-model='switch.is_open' v-on:change='switchClick(itemData)'>
<label></label>
</div>`,
methods:{
switchClick:function (row) {
var el = event.currentTarget;
if (el.checked) {
status = 1
} else {
status = 2
}
TourismLoading.show();
$.get('url', {
id: row.id,
is_open: status
}, function (request) {
TourismLoading.hide();
if (parseInt(request.code) === 0) {
success('成功');
} else {
error(request.message);
return false;
}
})
}
},
computed:{
switch(){
var _self = this;
if(_self.itemData.is_open == 2){
_self.itemData.is_open = 0;
}
return _self.itemData;
}
}
});
怎么才能让他兼容呢,试了网上的一些方法,都不可以
沧海一幻觉
相关分类