xianniu-ui 0.7.0 → 0.7.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xianniu-ui",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "private": false,
5
5
  "main": "lib/xianniu-ui.umd.min.js",
6
6
  "scripts": {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="xn-card">
3
3
  <div class="xn-card-header flex justify-content-between">
4
- <slot name="title" v-if="title">
4
+ <slot name="title" v-if="title || $slots.title">
5
5
  <slot name="title">
6
6
  <h3><span>{{title}}</span></h3>
7
7
  </slot>
@@ -190,7 +190,7 @@ export default {
190
190
  return Promise.all([
191
191
  this.checkFileExt(file),
192
192
  this.onExceedSize(file.size),
193
- this.getStsToken(),
193
+ this.getStsToken(file),
194
194
  ])
195
195
  .then(() => {
196
196
  return Promise.resolve();
@@ -280,6 +280,7 @@ export default {
280
280
  return this.$utils.download({url, name})
281
281
  },
282
282
  handleRemove(file, fileList) {
283
+ console.log('file, fileList: ', file, fileList,this.files);
283
284
  fileList.forEach((item, idx) => {
284
285
  if (file.uid === item.uid) {
285
286
  fileList.splice(idx, 1);
package/src/oss/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const OSS = require('ali-oss')
2
2
  import $dayjs from '@/utils/dayjs'
3
3
  const { v4: uuidv4 } = require('uuid');
4
-
4
+ import { Message } from 'element-ui';
5
5
  class Client {
6
6
  constructor(params = {}) {
7
7
  this.uploadHost = null
@@ -33,10 +33,12 @@ class Client {
33
33
  const uuid = uuidv4()
34
34
  return uuid
35
35
  }
36
- getStsToken() {
36
+ getStsToken(file) {
37
37
  return new Promise((resolve, reject) => {
38
38
  if (!this.stsUrl) {
39
- return console.error('获取临时凭证地址不能为空')
39
+ Message.error('获取临时凭证地址不能为空')
40
+ file.onError()
41
+ return
40
42
  }
41
43
 
42
44
  fetch(this.stsUrl + '?xnToken=' + this.getToken()).then(response => response.json()).then((res) => {