├── .gitignore
├── .npmignore
├── README.md
├── babel.config.js
├── example
├── App.vue
└── main.js
├── lib
├── EleUploadVideo.vue
└── index.js
├── package-lock.json
├── package.json
├── public
├── example.gif
├── favicon.ico
└── index.html
├── vue.config.js
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules
3 | /dist
4 |
5 | # local env files
6 | .env.local
7 | .env.*.local
8 |
9 | # Log files
10 | npm-debug.log*
11 | yarn-debug.log*
12 | yarn-error.log*
13 |
14 | # Editor directories and files
15 | .idea
16 | .vscode
17 | *.suo
18 | *.ntvs*
19 | *.njsproj
20 | *.sln
21 | *.sw?
22 |
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | tests
3 | docs
4 | documentation
5 | public
6 | vue.config.js
7 | coverage
8 | jest.config.js
9 | .eslintrc.js
10 | cypress.json
11 | postcss.config.js
12 | babel.config.js
13 | .editorconfig
14 | .cypress.json
15 | dist/demo.html
16 | .browserslistrc
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-ele-upload-video | 使得视频上传更加容易
2 |
3 | [](https://opensource.org/licenses/mit-license.php)
4 | [](https://www.npmjs.com/package/vue-ele-upload-video)
5 | [](https://www.npmjs.com/package/vue-ele-upload-video)
6 | [](https://npmcharts.com/compare/vue-ele-upload-video?minimal=true)
7 |
8 | ## 介绍
9 |
10 | vue-ele-upload-video 对 element-ui 中 upload 组件进一步封装,使得视频上传更加容易
11 |
12 | ## 效果图
13 |
14 | 
15 |
16 | ## 在线示例
17 |
18 | [https://codepen.io/dream2023/pen/ZNVvBg/](https://codepen.io/dream2023/pen/ZNVvBg/)
19 |
20 | ## 安装
21 |
22 | ```bash
23 | npm install vue-ele-upload-video --save
24 | ```
25 |
26 | ## 使用
27 |
28 | ```js
29 | // 全局引入
30 | import EleUploadVideo from "vue-ele-upload-video";
31 | Vue.component(EleUploadVideo.name, EleUploadVideo);
32 | ```
33 |
34 | ```js
35 | // 局部引入
36 | import EleUploadVideo from "vue-ele-upload-video";
37 | export default {
38 | components: {
39 | EleUploadVideo
40 | }
41 | };
42 | ```
43 |
44 | ## 示例(上传到七牛云)
45 |
46 | ```html
47 |
48 |
59 |
60 |
61 |
80 | ```
81 |
82 | ## Props 参数
83 |
84 | ```js
85 | props: {
86 | // 值
87 | value: {
88 | type: String
89 | },
90 | // 上传地址
91 | action: {
92 | type: String,
93 | required: true
94 | },
95 | // 响应处理函数
96 | responseFn: Function,
97 | // 文件大小限制(Mb)
98 | fileSize: {
99 | type: Number
100 | },
101 | // 显示宽度(px)
102 | width: {
103 | type: Number,
104 | default: 360
105 | },
106 | // 显示高度(默认auto)
107 | height: {
108 | type: Number
109 | },
110 | // 是否显示提示
111 | isShowTip: {
112 | type: Boolean,
113 | default: true
114 | },
115 | // 是否显示上传成功的提示
116 | isShowSuccessTip: {
117 | type: Boolean,
118 | default: true,
119 | },
120 | // 文件类型
121 | fileType: {
122 | type: Array
123 | },
124 | // 设置上传的请求头部(同官网)
125 | headers: Object,
126 | // 支持发送 cookie 凭证信息 (同官网)
127 | withCredentials: {
128 | type: Boolean,
129 | default: false
130 | },
131 | // 上传时附带的额外参数(同官网)
132 | data: {
133 | type: Object
134 | },
135 | // 上传的文件字段名 (同官网)
136 | name: {
137 | type: String,
138 | default: 'file'
139 | },
140 | // 覆盖默认的上传行为,可以自定义上传的实现 (同官网)
141 | httpRequest: Function,
142 | // 接受上传的文件类型(thumbnail-mode 模式下此参数无效)(同官网)
143 | accept: String,
144 | // 删除前的操作(同官网)
145 | beforeRemove: Function,
146 | }
147 | ```
148 |
149 | ## 参考链接
150 |
151 | - [element-ui upload 组件](https://element.eleme.cn/#/zh-CN/component/upload)
152 | - [element-ui progress 组件](https://element.eleme.cn/#/zh-CN/component/progress)
153 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | presets: [
3 | '@vue/app'
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/example/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
36 |
37 |
--------------------------------------------------------------------------------
/example/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import ElementUI from 'element-ui'
4 | import EleUploadVideo from '../lib/index'
5 | import 'element-ui/lib/theme-chalk/index.css'
6 |
7 | Vue.config.productionTip = false
8 | Vue.use(ElementUI)
9 | Vue.component(EleUploadVideo.name, EleUploadVideo)
10 |
11 | new Vue({
12 | render: h => h(App)
13 | }).$mount('#app')
14 |
--------------------------------------------------------------------------------
/lib/EleUploadVideo.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
21 |
22 |
28 |
29 |
30 |
31 |
32 |
33 | 将视频拖到此处,或
34 | 点击上传
35 |
36 |
37 | 请上传
38 | {{
40 | this.fileType ? this.fileType.join("/") : "视频"
41 | }} 格式文件
43 |
44 | ,且文件大小不超过
45 | {{ fileSize }} MB
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
85 |
86 |
87 |
88 |
89 |
254 |
255 |
264 |
--------------------------------------------------------------------------------
/lib/index.js:
--------------------------------------------------------------------------------
1 | import EleUploadVideo from './EleUploadVideo'
2 |
3 | if (window && window.Vue) {
4 | // 浏览器环境
5 | window.Vue.component(EleUploadVideo.name, EleUploadVideo)
6 | }
7 |
8 | export default EleUploadVideo
9 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-ele-upload-video",
3 | "description": "vue-ele-upload-video 对 element-ui 中 upload 组件进一步封装,使得视频上传更加容易",
4 | "version": "2.0.6",
5 | "private": false,
6 | "scripts": {
7 | "serve": "vue-cli-service serve",
8 | "build": "vue build -t lib --name vue-ele-upload-video -d ./dist/ ./lib/index.js",
9 | "lint": "vue-cli-service lint"
10 | },
11 | "repository": {
12 | "type": "git",
13 | "url": "https://github.com/dream2023/vue-ele-upload-video"
14 | },
15 | "main": "lib/index.js",
16 | "homepage": "https://github.com/dream2023/vue-ele-upload-video/",
17 | "keywords": [
18 | "vue-ele-upload-video",
19 | "vue",
20 | "vue video",
21 | "element",
22 | "element video",
23 | "element-ui video"
24 | ],
25 | "dependencies": {
26 | "vue-hover-mask": "^1.0.0"
27 | },
28 | "devDependencies": {
29 | "@vue/cli-plugin-babel": "^3.8.0",
30 | "@vue/cli-plugin-eslint": "^3.8.0",
31 | "@vue/cli-service": "^3.8.0",
32 | "babel-eslint": "^10.0.1",
33 | "core-js": "^2.6.5",
34 | "element-ui": "^2.9.1",
35 | "eslint": "^5.16.0",
36 | "eslint-plugin-vue": "^5.0.0",
37 | "vue": "^2.6.10",
38 | "vue-template-compiler": "^2.6.10"
39 | },
40 | "eslintConfig": {
41 | "root": true,
42 | "env": {
43 | "node": true
44 | },
45 | "extends": [
46 | "plugin:vue/essential",
47 | "eslint:recommended"
48 | ],
49 | "rules": {},
50 | "parserOptions": {
51 | "parser": "babel-eslint"
52 | }
53 | },
54 | "postcss": {
55 | "plugins": {
56 | "autoprefixer": {}
57 | }
58 | },
59 | "browserslist": [
60 | "> 1%",
61 | "last 2 versions"
62 | ]
63 | }
64 |
--------------------------------------------------------------------------------
/public/example.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dream2023/vue-ele-upload-video/7cf558e99906e5cef3e604060787178540899a2f/public/example.gif
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dream2023/vue-ele-upload-video/7cf558e99906e5cef3e604060787178540899a2f/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | vue-ele-upload-video
9 |
10 |
11 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/vue.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | css: { extract: false },
3 | configureWebpack: {
4 | entry: './example/main.js',
5 | output: {
6 | libraryExport: 'default'
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------