var app = new Vue({
el: '#app',
delimiters: ['${', '}'],
data: {
onLoad: false,
video_num: $.cookie("video_num")
},
methods: {
change_danshuang: (e) => {
var listObj = $('.video-list')
var shuang = listObj.hasClass("two");
if (shuang) {
$(e.currentTarget).find("span").removeClass("two")
listObj.removeClass("two")
$.cookie("video_num", "", {
path: "/"
})
} else {
listObj.addClass("two")
$(e.currentTarget).find("span").addClass("two")
$.cookie("video_num", "two", {
path: "/"
})
}
},
filter: (e) => {
obj = $(e.currentTarget)
var open = obj.hasClass('this')
var width = obj.outerWidth(true)
var left = obj.offset().left;
if (open) {
obj.removeClass('this')
$('.videos-filter-item').hide();
} else {
obj.addClass('this')
$('.videos-filter-item .videos-filter-item-dot').css('left', width / 2 + left)
$('.videos-filter-item').show();
}
}
},
mounted: function() {
this.onLoad = true
this.$nextTick(function() {
if ($.cookie("video_num") === "two") {
$(".change_danshuang span").addClass('two')
} else {
$(".change_danshuang span").removeClass('two')
}
})
}
});