@bsgoal/common 1.6.8 → 1.7.0

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": "@bsgoal/common",
3
- "version": "1.6.8",
3
+ "version": "1.7.0",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -0,0 +1,50 @@
1
+ <!--
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-05-18 16:24:31
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-05-18 16:54:41
6
+ * @FilePath: \common\src\components\bsgoal-base-button\demo.vue
7
+ * @Description: 按钮 演示
8
+ *
9
+ -->
10
+
11
+ <script setup>
12
+ /* setup模板
13
+ ---------------------------------------------------------------- */
14
+ import { ref } from 'vue'
15
+ import BsgoalBaseButton from './index.vue'
16
+ // props
17
+ const props = defineProps({})
18
+
19
+ const task = () => {
20
+ return new Promise((resolve) => {
21
+ setTimeout(() => {
22
+ resolve()
23
+ }, 3000)
24
+ })
25
+ }
26
+ </script>
27
+ <script>
28
+ export default {
29
+ name: 'BsgoalBaseButtonDemo'
30
+ }
31
+ </script>
32
+ <template>
33
+ <div class="bsgoal-base-button-demo">
34
+ <BsgoalBaseButton :task="task"> </BsgoalBaseButton>
35
+ <BsgoalBaseButton :task="task" #default="{ loading }">
36
+ <div>
37
+ {{ loading }}
38
+ <el-button type="danger" :loading="loading">外部</el-button>
39
+ </div>
40
+ </BsgoalBaseButton>
41
+ </div>
42
+ </template>
43
+ <style lang="scss" scoped>
44
+ /* 自定义样式
45
+ ---------------------------------------------------------------- */
46
+ </style>
47
+ <style lang="scss">
48
+ /* 覆盖样式
49
+ ---------------------------------------------------------------- */
50
+ </style>
@@ -0,0 +1,77 @@
1
+ <!--
2
+ * @Author: canlong.shen
3
+ * @Date: 2023-05-18 16:24:25
4
+ * @LastEditors: canlong.shen
5
+ * @LastEditTime: 2023-05-18 17:00:41
6
+ * @FilePath: \common\src\components\bsgoal-base-button\index.vue
7
+ * @Description: 统一按钮
8
+ *
9
+ -->
10
+
11
+ <script setup>
12
+ /* setup模板
13
+ ---------------------------------------------------------------- */
14
+ import { ref, unref } from 'vue'
15
+ import { Plus } from '@element-plus/icons-vue'
16
+
17
+ // props
18
+ const props = defineProps({
19
+ task: {
20
+ type: [Object, Function],
21
+ default: () => {
22
+ Promise.resolve()
23
+ }
24
+ },
25
+ type: {
26
+ type: [String],
27
+ default: 'primary',
28
+ validator: (v) => ['primary', 'success', 'warning', 'danger', 'info'].includes(v)
29
+ },
30
+ icon: {
31
+ type: [String, Object],
32
+ default: Plus
33
+ },
34
+ content: {
35
+ type: [String],
36
+ default: '新增'
37
+ }
38
+ })
39
+
40
+ // ---> S 触发按钮 <---
41
+ const loading = ref(false)
42
+ const triggerClick = () => {
43
+ loading.value = true
44
+ const { task } = props
45
+ const taskValue = unref(task)
46
+ taskValue()
47
+ .then()
48
+ .finally(() => {
49
+ loading.value = false
50
+ })
51
+ }
52
+ // ---> E 触发按钮 <---
53
+ </script>
54
+ <script>
55
+ export default {
56
+ name: 'BsgoalBaseButton'
57
+ }
58
+ </script>
59
+ <template>
60
+ <div class="bsgoal-base-button">
61
+ <div class="base_button" @click="triggerClick">
62
+ <slot :loading="loading">
63
+ <el-button :type="type" :icon="icon" :loading="loading">{{ content }}</el-button>
64
+ </slot>
65
+ </div>
66
+ </div>
67
+ </template>
68
+ <style lang="scss">
69
+ /* 覆盖样式
70
+ ---------------------------------------------------------------- */
71
+ .bsgoal-base-button {
72
+ &,
73
+ .base_button {
74
+ display: inline-block;
75
+ }
76
+ }
77
+ </style>
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-04-10 10:41:52
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-05-10 13:54:41
5
+ * @LastEditTime: 2023-05-18 16:38:23
6
6
  * @FilePath: \common\src\router\index.js
7
7
  * @Description: 路由配置
8
8
  *
@@ -80,9 +80,14 @@ const router = createRouter({
80
80
  },
81
81
  {
82
82
  path: 'bsgoal-base-link-demo',
83
- name: '链接公共组件',
83
+ name: '链接',
84
84
  component: import('@/components/bsgoal-base-link/demo.vue')
85
85
  },
86
+ {
87
+ path: 'bsgoal-base-button-demo',
88
+ name: '按钮',
89
+ component: import('@/components/bsgoal-base-button/demo.vue')
90
+ },
86
91
  ]
87
92
  }
88
93
  ]