@ddwl/ddwl-ui 1.1.5 → 1.1.7

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.
@@ -1,99 +1,99 @@
1
- <!-- 二次确认弹窗 -->
2
- <template>
3
- <div class="inline">
4
- <span
5
- v-if="button === 'text'"
6
- slot="reference"
7
- :class="`${buttonType || 'primary'}-text-btn ${disabled ? 'disabled': ''}`"
8
- @click="() => { visible = true }"
9
- >
10
- {{ buttonName }}
11
- </span>
12
- <el-button
13
- v-else
14
- :disabled="disabled"
15
- :icon="buttonIcon"
16
- :type="buttonType"
17
- @click="() => { visible = true }"
18
- >
19
- {{ buttonName }}
20
- </el-button>
21
- <d-dialog
22
- v-model="visible"
23
- :title="title"
24
- width="374px"
25
- append-to-body
26
- @submit="submit"
27
- >
28
- <div class="d-dialog-confirm-container">
29
- <i class="el-icon-warning" />
30
- <p class="d-dialog-confirm-content">
31
- <slot>您确定删除该信息?</slot>
32
- </p>
33
- </div>
34
- </d-dialog>
35
- </div>
36
- </template>
37
-
38
- <script>
39
- import DDialog from '../dialog'
40
-
41
- export default {
42
- name: 'DDialogConfirm',
43
- components: { DDialog },
44
- props: {
45
- buttonName: {
46
- default: '批量删除',
47
- type: String
48
- },
49
- buttonIcon: {
50
- default: '',
51
- type: String
52
- },
53
- buttonType: {
54
- default: '',
55
- type: String
56
- },
57
- title: {
58
- default: '提示',
59
- type: String
60
- },
61
- disabled: {
62
- default: false,
63
- type: Boolean
64
- },
65
- button: {
66
- default: 'button',
67
- type: String
68
- }
69
- },
70
- data () {
71
- return {
72
- visible: false
73
- }
74
- },
75
- methods: {
76
- submit (callback) {
77
- this.$emit('submit', callback)
78
- }
79
- }
80
- }
81
- </script>
82
-
83
- <style lang="scss" scoped>
84
- .d-dialog-confirm-container {
85
- display: flex;
86
- align-items: center;
87
- & > i {
88
- font-size: 28px;
89
- color: rgb(255, 153, 0);
90
- margin-right: 8px;
91
- }
92
- & > div {
93
- flex: 1;
94
- }
95
- .d-dialog-confirm-content {
96
- white-space: normal;
97
- }
98
- }
99
- </style>
1
+ <!-- 二次确认弹窗 -->
2
+ <template>
3
+ <div class="inline">
4
+ <span
5
+ v-if="button === 'text'"
6
+ slot="reference"
7
+ :class="`${buttonType || 'primary'}-text-btn ${disabled ? 'disabled': ''}`"
8
+ @click="() => { visible = true }"
9
+ >
10
+ {{ buttonName }}
11
+ </span>
12
+ <el-button
13
+ v-else
14
+ :disabled="disabled"
15
+ :icon="buttonIcon"
16
+ :type="buttonType"
17
+ @click="() => { visible = true }"
18
+ >
19
+ {{ buttonName }}
20
+ </el-button>
21
+ <d-dialog
22
+ v-model="visible"
23
+ :title="title"
24
+ width="374px"
25
+ append-to-body
26
+ @submit="submit"
27
+ >
28
+ <div class="d-dialog-confirm-container">
29
+ <i class="el-icon-warning" />
30
+ <p class="d-dialog-confirm-content">
31
+ <slot>您确定删除该信息?</slot>
32
+ </p>
33
+ </div>
34
+ </d-dialog>
35
+ </div>
36
+ </template>
37
+
38
+ <script>
39
+ import DDialog from '../dialog'
40
+
41
+ export default {
42
+ name: 'DDialogConfirm',
43
+ components: { DDialog },
44
+ props: {
45
+ buttonName: {
46
+ default: '批量删除',
47
+ type: String
48
+ },
49
+ buttonIcon: {
50
+ default: '',
51
+ type: String
52
+ },
53
+ buttonType: {
54
+ default: '',
55
+ type: String
56
+ },
57
+ title: {
58
+ default: '提示',
59
+ type: String
60
+ },
61
+ disabled: {
62
+ default: false,
63
+ type: Boolean
64
+ },
65
+ button: {
66
+ default: 'button',
67
+ type: String
68
+ }
69
+ },
70
+ data () {
71
+ return {
72
+ visible: false
73
+ }
74
+ },
75
+ methods: {
76
+ submit (callback) {
77
+ this.$emit('submit', callback)
78
+ }
79
+ }
80
+ }
81
+ </script>
82
+
83
+ <style lang="scss" scoped>
84
+ .d-dialog-confirm-container {
85
+ display: flex;
86
+ align-items: center;
87
+ & > i {
88
+ font-size: 28px;
89
+ color: rgb(255, 153, 0);
90
+ margin-right: 8px;
91
+ }
92
+ & > div {
93
+ flex: 1;
94
+ }
95
+ .d-dialog-confirm-content {
96
+ white-space: normal;
97
+ }
98
+ }
99
+ </style>
@@ -1,136 +1,136 @@
1
- <!-- 抽屉 -->
2
- <template>
3
- <el-drawer
4
- v-bind="$attrs"
5
- :title="title"
6
- :close-on-click-modal="false"
7
- :visible.sync="visible"
8
- :size="width"
9
- v-on="$listeners"
10
- @closed="closed"
11
- >
12
- <template slot="title">
13
- <slot name="title" />
14
- </template>
15
- <div class="flex-col hf">
16
- <div class="flex-1">
17
- <slot />
18
- </div>
19
- <div v-if="showButton" class="ar mt16">
20
- <el-button
21
- type="primary"
22
- :icon="submitButtonIcon"
23
- :loading="loading"
24
- @click="submit"
25
- >
26
- {{ submitButtonText }}
27
- </el-button>
28
- <el-button @click="cancel">
29
- {{ cancelButtonText }}
30
- </el-button>
31
- </div>
32
- </div>
33
- </el-drawer>
34
- </template>
35
-
36
- <script>
37
- export default {
38
- name: 'DDrawer',
39
- components: {},
40
- model: {
41
- prop: 'modelValue',
42
- event: 'change'
43
- },
44
- props: {
45
- modelValue: {
46
- type: Boolean,
47
- default: false
48
- },
49
- title: {
50
- type: String,
51
- default: ''
52
- },
53
- showButton: {
54
- type: Boolean,
55
- default: true
56
- },
57
- submitButtonText: {
58
- type: String,
59
- default: '确定'
60
- },
61
- submitButtonIcon: {
62
- type: String,
63
- default: ''
64
- },
65
- cancelButtonText: {
66
- type: String,
67
- default: '取消'
68
- },
69
- // 需要重置的表单ref
70
- formRefs: {
71
- type: [String, Array],
72
- default: ''
73
- },
74
- width: {
75
- type: String,
76
- default: '70%'
77
- }
78
- },
79
- data () {
80
- return {
81
- loading: false
82
- }
83
- },
84
- computed: {
85
- visible: {
86
- get () {
87
- return this.modelValue
88
- },
89
- set (value) {
90
- this.$emit('change', value)
91
- }
92
- }
93
- },
94
- methods: {
95
- getRef (ref) {
96
- return typeof ref === 'string' ? this.$parent.$refs[ref] : ref
97
- },
98
- async submit () {
99
- // 是否需要进行表单校验
100
- if (this.formRefs) {
101
- // 多表单校验
102
- if (Array.isArray(this.formRefs)) {
103
- await Promise.all(this.formRefs.map(ref => this.getRef(ref)?.validate()))
104
- } else {
105
- await this.getRef(this.formRefs)?.validate()
106
- }
107
- }
108
- this.loading = true
109
- this.$emit('submit', (status) => {
110
- this.loading = false
111
- if (!status) {
112
- this.visible = false
113
- }
114
- })
115
- },
116
- cancel () {
117
- this.$emit('cancel')
118
- this.visible = false
119
- },
120
- /**
121
- * @description: 弹窗关闭时清除表单校验
122
- */
123
- closed () {
124
- this.$emit('closed')
125
- if (this.formRefs) {
126
- // 多表单校验
127
- if (Array.isArray(this.formRefs)) {
128
- this.formRefs.forEach(ref => this.getRef(ref)?.resetFields())
129
- } else {
130
- this.getRef(this.formRefs)?.resetFields()
131
- }
132
- }
133
- }
134
- }
135
- }
136
- </script>
1
+ <!-- 抽屉 -->
2
+ <template>
3
+ <el-drawer
4
+ v-bind="$attrs"
5
+ :title="title"
6
+ :close-on-click-modal="false"
7
+ :visible.sync="visible"
8
+ :size="width"
9
+ v-on="$listeners"
10
+ @closed="closed"
11
+ >
12
+ <template slot="title">
13
+ <slot name="title" />
14
+ </template>
15
+ <div class="flex-col hf">
16
+ <div class="flex-1">
17
+ <slot />
18
+ </div>
19
+ <div v-if="showButton" class="ar mt16">
20
+ <el-button
21
+ type="primary"
22
+ :icon="submitButtonIcon"
23
+ :loading="loading"
24
+ @click="submit"
25
+ >
26
+ {{ submitButtonText }}
27
+ </el-button>
28
+ <el-button @click="cancel">
29
+ {{ cancelButtonText }}
30
+ </el-button>
31
+ </div>
32
+ </div>
33
+ </el-drawer>
34
+ </template>
35
+
36
+ <script>
37
+ export default {
38
+ name: 'DDrawer',
39
+ components: {},
40
+ model: {
41
+ prop: 'modelValue',
42
+ event: 'change'
43
+ },
44
+ props: {
45
+ modelValue: {
46
+ type: Boolean,
47
+ default: false
48
+ },
49
+ title: {
50
+ type: String,
51
+ default: ''
52
+ },
53
+ showButton: {
54
+ type: Boolean,
55
+ default: true
56
+ },
57
+ submitButtonText: {
58
+ type: String,
59
+ default: '确定'
60
+ },
61
+ submitButtonIcon: {
62
+ type: String,
63
+ default: ''
64
+ },
65
+ cancelButtonText: {
66
+ type: String,
67
+ default: '取消'
68
+ },
69
+ // 需要重置的表单ref
70
+ formRefs: {
71
+ type: [String, Array],
72
+ default: ''
73
+ },
74
+ width: {
75
+ type: String,
76
+ default: '70%'
77
+ }
78
+ },
79
+ data () {
80
+ return {
81
+ loading: false
82
+ }
83
+ },
84
+ computed: {
85
+ visible: {
86
+ get () {
87
+ return this.modelValue
88
+ },
89
+ set (value) {
90
+ this.$emit('change', value)
91
+ }
92
+ }
93
+ },
94
+ methods: {
95
+ getRef (ref) {
96
+ return typeof ref === 'string' ? this.$parent.$refs[ref] : ref
97
+ },
98
+ async submit () {
99
+ // 是否需要进行表单校验
100
+ if (this.formRefs) {
101
+ // 多表单校验
102
+ if (Array.isArray(this.formRefs)) {
103
+ await Promise.all(this.formRefs.map(ref => this.getRef(ref)?.validate()))
104
+ } else {
105
+ await this.getRef(this.formRefs)?.validate()
106
+ }
107
+ }
108
+ this.loading = true
109
+ this.$emit('submit', (status) => {
110
+ this.loading = false
111
+ if (!status) {
112
+ this.visible = false
113
+ }
114
+ })
115
+ },
116
+ cancel () {
117
+ this.$emit('cancel')
118
+ this.visible = false
119
+ },
120
+ /**
121
+ * @description: 弹窗关闭时清除表单校验
122
+ */
123
+ closed () {
124
+ this.$emit('closed')
125
+ if (this.formRefs) {
126
+ // 多表单校验
127
+ if (Array.isArray(this.formRefs)) {
128
+ this.formRefs.forEach(ref => this.getRef(ref)?.resetFields())
129
+ } else {
130
+ this.getRef(this.formRefs)?.resetFields()
131
+ }
132
+ }
133
+ }
134
+ }
135
+ }
136
+ </script>