vue demand loading controls

local:

  In fact, asynchronous loading control. But if the site is very much a control, such as providing an open design drag drag drag gizmo (may produce thousands of controls).

  Jsonp loaded asynchronously request use forms packaged js. That asynchronous loading these controls will be packaged into separate js (main js relatively lightweight).

  Vue mainly in import and use of Vue.component.

  Before using the controls (data control is bound before the change) must be registered in Vue.component (not found in the local vue dynamically added component assembly).

Vue.component (name, Resolve => 
        Import ( "...") 
          .then (RES => {// etc template first encountered this control time, will perform this then. Thus began this loaded controls 
            console.log (RES); 
            Resolve (RES); // must write this sentence, otherwise not obtain external plug-vue 
          }) 
          .catch (RES => console.log (RES)) 
      ); 
    } 
   . the this $ set. . .

  

Guess you like

Origin www.cnblogs.com/xunhanliu/p/11591889.html