(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