向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
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!