@xuekl/cli-components 1.5.7 → 1.5.9

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.
Files changed (2) hide show
  1. package/XklButton.vue +25 -1
  2. package/package.json +1 -1
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
- const props = defineProps(['auth'])
15
+ import { useAttrs } from 'vue'
16
+ import { ElMessageBox } from 'element-plus'
17
+
18
+ const props = defineProps(['auth', 'prevent'])
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,24 @@ const btnClick = () => {
30
35
  setTimeout(() => preventClick = false, 200)
31
36
  })
32
37
  }
38
+
39
+ if (attrs.onConfirm) {
40
+ if (props.prevent) {
41
+ ElMessageBox.confirm(
42
+ '当前内容可能存在修改,确认继续?',
43
+ '提示',
44
+ {
45
+ confirmButtonText: '确认',
46
+ cancelButtonText: '取消',
47
+ type: 'warning',
48
+ }
49
+ ).then(() => {
50
+ attrs.onConfirm()
51
+ }).catch(() => {
52
+ })
53
+ } else {
54
+ attrs.onConfirm()
55
+ }
56
+ }
33
57
  }
34
58
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuekl/cli-components",
3
- "version": "1.5.7",
3
+ "version": "1.5.9",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {