@xuekl/cli-components 1.5.7 → 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 +20 -0
- 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
|
+
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>
|