1、编写vue组件myUploader.js
<template>
<label :for="dataId" :style="dataStyle" class="upLoaderFile" :class="dataClass">
<input type="file" class="dishidden fileSelectUpButton" name="file" :id="dataId">
<slot name="textWord" class="textWord"></slot>
</label>
</template>
<script>
var fileUpLoader = require('../../libs/uploadFile/js/jquery.fileupload.js'); //上传图片
export default {
name: "myUpLoad",
}
2、编写vue组件myUploader,在index.js中导入进来(test.js)
import myUploader from "./myUploader ";
var install = function(Vue, options) {
if (install.installed) return;
debugger
Vue.component(myUploader.name, myUploader );
}
export default install;//返回install对象
//module.exports = {install};或许这类体式格局导入
3、在main.js中引入(main.js)
import myUploader from "./test.js";
Vue.use(myUploader );
4、页面上引入
不必导入,能够直接在想用的处所运用
<my-upLoad></my-upLoad>