[Vuejs]-Handle methods differently in Vue depending on mobile or not

0👍

First, according to you code, you dont need Main commonjs module to be a vuejs instance. Make it as a simple js object

Main = {
    mobule: document.clientWidth >= 992
}

export default Main;

Or you may want to handle client window size dynamically

var Main = new Vue({
    created: function() {
        // dunno why v-on="resize: func" not working
        global.window.addEventListener('resize', function () {
            //calc width and heigh somehow
            self.$broadcast('resize', width, heigh);
        });
    }
});

export default Main;
👤cuhuak

Leave a comment