vue custom js file write method

// global function method 
exports.install = function (Vue, Options) { 
    Vue.prototype. $ Popup = function (msg, Time) { 
          // msg content 
         // Time pop show time 
          time = isNaN (time)? 3000 : Time;
         var m = document.createElement ( 'div' ); 
        m.className = "popupall" 
        m.innerHTML = MSG; 
        document.body.appendChild (m); 
        the setTimeout ( function () {
             var D = 0.5 ; 
            m. style.webkitTransition= '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
            m.style.opacity = '0';
            setTimeout(function () {
                document.body.removeChild(m)
            }, d * 1000);
        }, time);
      
    };
};

Single Page Call

that. $ popup ( "published content", 3000)

main.js file reference

amount as from './public/js/com' 
Vue.use (as);

 

Guess you like

Origin www.cnblogs.com/chen527/p/11934552.html