Load script and css.
npm install popoloadIn some application scenarios, we need to customize the loading of certain Javascript plug-ins based on configuration, usually including plug-in dependency scripts and styles. Pooload can load plug-ins and their dependencies through configuration.
``js`
npm i popoload
or
`js`
`js
PL({
config: {
path: {
bootcdn: 'https://cdn.bootcss.com/'
}
},
libs: [
'bootcdn:jquery/3.1.1/jquery.min.js',
'bootcdn:leaflet/1.3.1/leaflet.js'
],
styles: [
'bootcdn:leaflet/1.3.1/leaflet.css'
],
loaded: function() {
if($ && L) {
$(document.body).html('All resource loaded.');
}
}
});
``
|Params|Type|Note|
|-|-|-|
|config|Object|config path.|
|config.path|Object|key-value, Key is a reference and value is the actual reference path.|
|libs|Array|Depending on the library script list, the value is key + ":" + dependency library file defined in config.path.|
|styles|Array|Depending on the library script list, the value is key + ":" + dependency library file defined in config.path.|
|loaded|Function|Load completion callback method|