@xuekl/cli-components 1.5.6 → 1.5.8

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/XklButton.vue CHANGED
@@ -12,10 +12,15 @@ export default {
12
12
  import { ElButton as RealElButton } from 'element-plus'
13
13
  import { componentGlobal } from '@xuekl/cli-base/global'
14
14
  import { isAuth } from '@/utils'
15
+ import { useAttrs } from 'vue'
16
+ import { ElMessageBox } from 'element-plus'
17
+
15
18
  const props = defineProps(['auth'])
16
19
  const emit = defineEmits(['click', 'async'])
17
20
 
18
21
  const { auth } = props
22
+
23
+ const attrs = useAttrs()
19
24
  let preventClick = false
20
25
 
21
26
  const btnClick = () => {
@@ -30,5 +35,20 @@ const btnClick = () => {
30
35
  setTimeout(() => preventClick = false, 200)
31
36
  })
32
37
  }
38
+
39
+ if (attrs.onConfirm) {
40
+ ElMessageBox.confirm(
41
+ '当前内容可能存在修改,确认继续?',
42
+ '提示',
43
+ {
44
+ confirmButtonText: '确认',
45
+ cancelButtonText: '取消',
46
+ type: 'warning',
47
+ }
48
+ ).then(() => {
49
+ attrs.onConfirm()
50
+ }).catch(() => {
51
+ })
52
+ }
33
53
  }
34
54
  </script>
package/XklUpload.vue CHANGED
@@ -33,6 +33,13 @@ const actionUrl = http.adornUrl(config.url || '/common/upload')
33
33
  const fileList = ref([])
34
34
 
35
35
  const beforeUpload = (file) => {
36
+ if (config.accept) {
37
+ if (!file.type.includes(config.accept)) {
38
+ ElMessage.warning(config.acceptTip ? config.acceptTip : `文件类型不正确`)
39
+ return false
40
+ }
41
+ }
42
+
36
43
  if (config.maxSize) {
37
44
  if (file.size > config.maxSize * 1024 * 1024) {
38
45
  ElMessage.warning(`文件大小不得超过${config.maxSize}M`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuekl/cli-components",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {