├── .babelrc
├── .editorconfig
├── .gitignore
├── README.md
├── dist
├── loading.gif
├── vue-upload-multiple-image.js
└── vue-upload-multiple-image.js.map
├── index.html
├── package-lock.json
├── package.json
├── src
├── App.vue
├── assets
│ ├── demo.png
│ └── logo.png
├── components
│ └── VueUploadMultipleImage.vue
└── main.js
├── webpack.config.js
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", { "modules": false }],
4 | "stage-3"
5 | ]
6 | }
7 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | indent_style = space
6 | indent_size = 2
7 | end_of_line = lf
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | node_modules/
3 | npm-debug.log
4 | yarn-error.log
5 |
6 | # Editor directories and files
7 | .idea
8 | *.suo
9 | *.ntvs*
10 | *.njsproj
11 | *.sln
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # vue-upload-multiple-image
4 | A simple upload multiple image component for Vuejs
5 | [NPM Package](https://www.npmjs.com/package/vue-upload-multiple-image)
6 |
7 | [Demo!](https://codepen.io/lekhang2512/pen/qJmQaZ)
8 |
9 | 
10 |
11 | ## Development (NPM / Yarn)
12 | ```
13 | npm run dev
14 | yarn dev
15 | ```
16 |
17 | ## Install
18 |
19 | #### NPM / Yarn
20 |
21 | Install the package:
22 |
23 | ```
24 | npm install vue-upload-multiple-image
25 | yarn add vue-upload-multiple-image
26 | ```
27 |
28 | Then import it in your project
29 |
30 | main.js
31 | ```javascript
32 | import VueLazyload from 'vue-lazyload'
33 |
34 | Vue.use(VueLazyload)
35 | ```
36 |
37 | ```javascript
38 | import VueUploadMultipleImage from 'vue-upload-multiple-image'
39 |
40 | export default {
41 | components: {
42 | VueUploadMultipleImage,
43 | },
44 | }
45 | ```
46 |
47 | #### Browser global
48 |
49 | ```html
50 |
51 |
52 | ```
53 |
54 | ## Usage
55 |
56 | You can simply view [App.vue](https://github.com/lekhang2512/vue-image-lightbox-carousel/blob/master/src/App.vue) to see how to use **vue-upload-multiple-image**
57 |
58 | How to use:
59 | ```html
60 |
66 | ```
67 | `images` has the structure:
68 | ```javascript
69 | [
70 | {
71 | path: 'http://example.com/image.jpg',
72 | default: 1,
73 | highlight: 1,
74 | caption: 'caption to display. receive', // Optional
75 | }
76 | ]
77 | ```
78 | ## Example
79 | ```html
80 |
81 |
82 |
90 |
91 |
92 |
93 |
128 |
129 |
157 |
158 | ```
159 | ## Options
160 |
161 | ### Props
162 |
163 |
164 |
165 | name |
166 | type |
167 | default |
168 | description |
169 |
170 |
171 |
172 |
173 | idUpload |
174 | String |
175 | image-upload |
176 | Id of input upload |
177 |
178 |
179 | idEdit |
180 | String |
181 | image-edit |
182 | Id of input edit |
183 |
184 |
185 | dragText |
186 | String |
187 | Kéo hình ảnh(nhiều) |
188 | Drag Text |
189 |
190 |
191 | browseText |
192 | String |
193 | (hoặc) Chọn |
194 | Browse Text |
195 |
196 |
197 | primaryText |
198 | String |
199 | Mặc định |
200 | Primary Text |
201 |
202 |
203 | markIsPrimaryText |
204 | String |
205 | Đặt làm mặc định |
206 | Set default image |
207 |
208 |
209 | popupText |
210 | String |
211 | Hình ảnh này sẽ được hiển thị làm mặc định |
212 | Description default image |
213 |
214 |
215 | dropText |
216 | String |
217 | Thả tệp của bạn ở đây ... |
218 | Drag and drop |
219 |
220 |
221 | accept |
222 | String |
223 | image/gif,image/jpeg,image/png,image/bmp,image/jpg |
224 | Accept |
225 |
226 |
227 | dataImages |
228 | Array |
229 | [] |
230 | Array images |
231 |
232 |
233 | multiple |
234 | Boolean |
235 | true |
236 | Set upload multiple image |
237 |
238 |
239 | showPrimary |
240 | Boolean |
241 | true |
242 | Show text default image |
243 |
244 |
245 | maxImage |
246 | Number |
247 | 5 |
248 | Maximum upload image |
249 |
250 |
251 | showEdit |
252 | Boolean |
253 | true |
254 | Show action edit |
255 |
256 |
257 | showDelete |
258 | Boolean |
259 | true |
260 | Show action delete |
261 |
262 |
263 | showAdd |
264 | Boolean |
265 | true |
266 | Show action add |
267 |
268 |
269 | disabled |
270 | Boolean |
271 | false |
272 | Disable upload image |
273 |
274 |
275 |
276 |
277 | ### Events
278 |
279 |
280 |
281 | name |
282 | arguments |
283 | description |
284 |
285 |
286 |
287 |
288 | upload-success |
289 | (formData, index, fileList) |
290 | Upload image succcess |
291 |
292 |
293 | edit-image |
294 | (formData, index, fileList) |
295 | Edit image succcess |
296 |
297 |
298 | before-remove |
299 | (index, done, fileList) |
300 | Before delete image |
301 |
302 |
303 | mark-is-primary |
304 | (index, fileList) |
305 | Set default image |
306 |
307 |
308 | limit-exceeded |
309 | amount |
310 | Limit exceeded images when drop |
311 |
312 |
313 |
314 |
315 | ## Dependencies
316 | - [lodash](https://github.com/lodash/lodash/)
317 | - [vue-image-lightbox-carousel](https://github.com/lekhang2512/vue-image-lightbox-carousel)
318 | - [vue-popperjs](https://github.com/RobinCK/vue-popper#readme)
319 |
--------------------------------------------------------------------------------
/dist/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lekhang2512/vue-upload-multiple-image/3afc9fbe60ce37118f69cf68828adb83be1ffa49/dist/loading.gif
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | vue-upload-multiple-image
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-upload-multiple-image",
3 | "description": "A Vue.js project",
4 | "version": "1.1.6",
5 | "author": "Lee Khang ",
6 | "license": "MIT",
7 | "main": "src/main.js",
8 | "scripts": {
9 | "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
10 | "build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
11 | },
12 | "dependencies": {
13 | "axios": "^0.18.0",
14 | "lodash": "^4.17.11",
15 | "vue": "^2.5.11",
16 | "vue-image-lightbox-carousel": "^1.0.7",
17 | "vue-popperjs": "^1.5.3"
18 | },
19 | "browserslist": [
20 | "> 1%",
21 | "last 2 versions",
22 | "not ie <= 8"
23 | ],
24 | "devDependencies": {
25 | "babel-core": "^6.26.0",
26 | "babel-loader": "^7.1.2",
27 | "babel-preset-env": "^1.6.0",
28 | "babel-preset-stage-3": "^6.24.1",
29 | "cross-env": "^5.0.5",
30 | "css-loader": "^0.28.7",
31 | "file-loader": "^1.1.4",
32 | "vue-loader": "^13.0.5",
33 | "vue-template-compiler": "^2.4.4",
34 | "webpack": "^3.6.0",
35 | "webpack-dev-server": "^2.9.1"
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
53 |
--------------------------------------------------------------------------------
/src/assets/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lekhang2512/vue-upload-multiple-image/3afc9fbe60ce37118f69cf68828adb83be1ffa49/src/assets/demo.png
--------------------------------------------------------------------------------
/src/assets/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lekhang2512/vue-upload-multiple-image/3afc9fbe60ce37118f69cf68828adb83be1ffa49/src/assets/logo.png
--------------------------------------------------------------------------------
/src/components/VueUploadMultipleImage.vue:
--------------------------------------------------------------------------------
1 |
2 |
12 |
16 |
21 |
22 |
29 |
{{dropText}}
30 |
31 |
32 |
37 |
38 |
47 |
48 |
49 |
50 |
51 |
{{browseText}}
52 |
53 |
54 |
59 |
60 |
61 |
62 |
63 |
67 |
72 |
73 |
80 |
{{dropText}}
81 |
82 |
83 |
87 |
91 |
92 |
93 |
101 |
102 |
103 |
![]()
107 |
108 |
109 |
113 |
117 |
121 |
122 |
138 | {{primaryText}}
139 |
140 |
144 |
145 | {{popupText}}
146 |
147 |
151 |
159 |
160 |
161 |
162 |
{{markIsPrimaryText}}
167 |
168 |
201 |
202 |
203 |
204 |
205 |
209 |
216 |
217 |
![]()
221 |
222 |
223 |
227 |
236 |
237 |
242 |
243 |
244 |
245 |
246 |
256 |
265 |
266 |
267 |
275 |
276 |
277 |
278 |
279 |
565 |
566 |
817 |
822 |
--------------------------------------------------------------------------------
/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import App from './App.vue'
3 | import VueUploadMultipleImage from './components/VueUploadMultipleImage'
4 |
5 | if (document.querySelector('#my-strictly-unique-vue-upload-multiple-image')) {
6 | Vue.component('VueUploadMultipleImage', VueUploadMultipleImage)
7 |
8 | new Vue({
9 | el: '#my-strictly-unique-vue-upload-multiple-image',
10 | render: h => h(App)
11 | })
12 | }
13 |
14 | export default VueUploadMultipleImage
15 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 | var webpack = require('webpack')
3 |
4 | module.exports = {
5 | entry: './src/main.js',
6 | output: {
7 | path: path.resolve(__dirname, './dist'),
8 | publicPath: '/dist/',
9 | filename: 'vue-upload-multiple-image.js'
10 | },
11 | module: {
12 | rules: [
13 | {
14 | test: /\.css$/,
15 | use: [
16 | 'vue-style-loader',
17 | 'css-loader'
18 | ],
19 | }, {
20 | test: /\.vue$/,
21 | loader: 'vue-loader',
22 | options: {
23 | loaders: {
24 | }
25 | // other vue-loader options go here
26 | }
27 | },
28 | {
29 | test: /\.js$/,
30 | loader: 'babel-loader',
31 | exclude: /node_modules/
32 | },
33 | {
34 | test: /\.(png|jpg|gif|svg)$/,
35 | loader: 'file-loader',
36 | options: {
37 | name: '[name].[ext]?[hash]'
38 | }
39 | }
40 | ]
41 | },
42 | resolve: {
43 | alias: {
44 | 'vue$': 'vue/dist/vue.esm.js'
45 | },
46 | extensions: ['*', '.js', '.vue', '.json']
47 | },
48 | devServer: {
49 | historyApiFallback: true,
50 | noInfo: true,
51 | overlay: true
52 | },
53 | performance: {
54 | hints: false
55 | },
56 | devtool: '#eval-source-map'
57 | }
58 |
59 | if (process.env.NODE_ENV === 'production') {
60 | module.exports.devtool = '#source-map'
61 | // http://vue-loader.vuejs.org/en/workflow/production.html
62 | module.exports.plugins = (module.exports.plugins || []).concat([
63 | new webpack.DefinePlugin({
64 | 'process.env': {
65 | NODE_ENV: '"production"'
66 | }
67 | }),
68 | new webpack.optimize.UglifyJsPlugin({
69 | sourceMap: true,
70 | compress: {
71 | warnings: false
72 | }
73 | }),
74 | new webpack.LoaderOptionsPlugin({
75 | minimize: true
76 | })
77 | ])
78 | }
79 |
--------------------------------------------------------------------------------