向Vue实例混入plusready
时间:2018-08-21 12:35:06
收藏:0
阅读:1373
(function () {
var onPlusReady = function (callback, context = this) {
if (window.plus) {
callback.call(context);
} else {
document.addEventListener(‘plusready‘, callback.bind(context));
}
};
Vue.mixin({
beforeCreate: function () {
onPlusReady(function () {
this.plusReady = true;
}, this);
},
methods: {
onPlusReady: onPlusReady
}
});
}());原文:https://www.cnblogs.com/xiaoyucoding/p/9510628.html
评论(0)