1.0.1 • Published 6 years ago

vue-m-loader v1.0.1

Weekly downloads
10
License
MIT
Repository
github
Last release
6 years ago

m-loader

用于加载第三方脚本的组件

Example

npm

npm install -S vue-m-loader

use

import MLoader from 'vue-m-loader'

Vue.use(MLoader) // 注册组件 m-loader,注册方法 $loader

or

import {MLoader, loader} from 'vue-m-loader

loader({
  url: 'https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js',
  library: 'jQuery'
}).then(library => {
  console.log(library.target)
}).catch(err => {
  console.log(err)
})

MLoder Attributes

参数说明类型可选值默认值
urlurlstring
type类型stringscript/linkscript
library挂载window下的属性string
force是否重新加载booleantrue/falsefalse

$loader

// 在vue组件里使用

this.$loader(options)
参数说明类型可选值默认值
options.urlurlstring
options.type类型stringscript/linkscript
options.library挂载window下的属性string
options.force是否重新加载booleantrue/falsefalse