mali-applet-ui 0.2.89 → 0.2.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,6 +56,7 @@
56
56
  <script>
57
57
  import XEUtils from 'xe-utils'
58
58
  import globalStore from '../../config/store'
59
+ import { getFileSuffix } from '../../utils/file'
59
60
  import { uploadAllFiles, uploadImageFiles } from './file-handle'
60
61
 
61
62
  export default {
@@ -183,13 +184,13 @@ export default {
183
184
  const obj = {
184
185
  id: null,
185
186
  [this.nameField]: name,
186
- [this.typeField]: this.getSuffix(name),
187
+ [this.typeField]: getFileSuffix(name),
187
188
  [this.urlField]: url
188
189
  }
189
190
  return {
190
191
  id: null,
191
192
  [this.nameField]: name,
192
- [this.typeField]: this.getSuffix(name),
193
+ [this.typeField]: getFileSuffix(name),
193
194
  [this.urlField]: url,
194
195
  tempPath: this.getUrl(obj)
195
196
  }
@@ -246,14 +247,6 @@ export default {
246
247
  const urlRest = XEUtils.parseUrl(url)
247
248
  return urlRest.pathname.split('/').slice(-1)[0] || ''
248
249
  },
249
- getSuffix (filename) {
250
- const pos = filename.lastIndexOf('.')
251
- let suffix = ''
252
- if (pos !== -1) {
253
- suffix = filename.substring(pos + 1)
254
- }
255
- return suffix
256
- },
257
250
  previewImageEvent (item, index) {
258
251
  if (this.previewStatus) {
259
252
  return
@@ -377,7 +370,7 @@ export default {
377
370
  this.loading = true
378
371
  Promise.all(
379
372
  tempFiles.map(file => {
380
- const fileSuffix = this.getSuffix(file.name)
373
+ const fileSuffix = getFileSuffix(file.name)
381
374
  if (uploadMethod) {
382
375
  return Promise.resolve(
383
376
  uploadMethod.call(this.currVM, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.2.89",
3
+ "version": "0.2.91",
4
4
  "description": "码里云小程序组件库",
5
5
  "scripts": {
6
6
  "release": "node script/release.js && npm publish"
package/utils/file.js CHANGED
@@ -1,3 +1,12 @@
1
+ export function getFileSuffix (filename) {
2
+ const pos = filename.lastIndexOf('.')
3
+ let suffix = ''
4
+ if (pos !== -1) {
5
+ suffix = filename.substring(pos + 1)
6
+ }
7
+ return suffix
8
+ }
9
+
1
10
  /**
2
11
  * 下载文件
3
12
  * @param {*} url