@bsgoal/common 2.7.0 → 2.7.2

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": "2.7.0",
3
+ "version": "2.7.2",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist",
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-05-29 09:38:59
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-05-29 10:00:37
5
+ * @LastEditTime: 2023-05-29 18:01:43
6
6
  * @FilePath: \common\src\components\bsgoal-base-input\demo.vue
7
7
  * @Description: Input 输入框 演示
8
8
  *
@@ -19,12 +19,17 @@ const props = defineProps({})
19
19
 
20
20
  const inputValue = ref('')
21
21
 
22
+ const test = () => {
23
+ inputValue.value = '666'
24
+ }
25
+
22
26
  </script>
23
27
  <template>
24
28
  <div class="bsgoal-base-input-demo">
25
29
  <div class="base_input_demo">
26
30
  {{ inputValue }}
27
31
  <BsgoalBaseInput v-model="inputValue"/>
32
+ <el-button type="primary" @click="test">测试</el-button>
28
33
  </div>
29
34
  </div>
30
35
  </template>
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-05-29 09:38:52
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-05-29 11:41:48
5
+ * @LastEditTime: 2023-05-29 18:01:19
6
6
  * @FilePath: \common\src\components\bsgoal-base-input\index.vue
7
7
  * @Description: Input 输入框
8
8
  *
@@ -11,7 +11,8 @@
11
11
  <script setup>
12
12
  /* setup模板
13
13
  ---------------------------------------------------------------- */
14
- import { ref, watch } from 'vue'
14
+ import { processSlotOutlet } from '@vue/compiler-core'
15
+ import { ref, watch, watchEffect } from 'vue'
15
16
 
16
17
  defineOptions({
17
18
  name: 'BsgoalBaseInput'
@@ -63,9 +64,10 @@ const emits = defineEmits(['update:modelValue', 'change'])
63
64
 
64
65
  // ---> S 值绑定 <---
65
66
 
66
- const inputValue = ref(props.modelValue)
67
- watch(inputValue, (value = '') => {
68
- emits('update:modelValue', value)
67
+ const inputValue = ref('')
68
+
69
+ watchEffect(() => {
70
+ inputValue.value = props.modelValue
69
71
  })
70
72
 
71
73
  // ---> E 值绑定 <---
@@ -74,12 +76,33 @@ watch(inputValue, (value = '') => {
74
76
 
75
77
  /**
76
78
  * @Author: canlong.shen
77
- * @description: 值变动
79
+ * @description: 触发 变动输入
78
80
  * @default:
79
81
  * @return {*}
80
82
  */
81
83
  const change = (value = '') => {
82
84
  emits('change', value)
85
+ emits('update:modelValue', value)
86
+ }
87
+ /**
88
+ * @Author: canlong.shen
89
+ * @description: 触发 清空输入
90
+ * @default:
91
+ * @return {*}
92
+ */
93
+ const clear = (value = '') => {
94
+ emits('clear', value)
95
+ emits('update:modelValue', value)
96
+ }
97
+ /**
98
+ * @Author: canlong.shen
99
+ * @description: 触发 输入事件
100
+ * @default:
101
+ * @return {*}
102
+ */
103
+ const input = (value = '') => {
104
+ emits('input', value)
105
+ emits('update:modelValue', value)
83
106
  }
84
107
 
85
108
  // ---> E 事件 <---
@@ -96,6 +119,8 @@ const change = (value = '') => {
96
119
  :formatter="formatter"
97
120
  :parser="parser"
98
121
  @change="change"
122
+ @clear="clear"
123
+ @input="input"
99
124
  />
100
125
  </div>
101
126
  </template>
@@ -47,12 +47,17 @@ const change = (value = '', data = {}) => {
47
47
  console.log('value', value)
48
48
  console.log('data', data)
49
49
  }
50
+
51
+ const test = (params = '') => {
52
+ selectValue.value = '444'
53
+ }
50
54
  </script>
51
55
  <template>
52
56
  <div class="bsgoal-base-select-demo">
53
57
  <div class="base_select_demo">
54
58
  {{ selectValue }}
55
59
  <BsgoalBaseSelect v-model="selectValue" :range="selectRange" @change="change" />
60
+ <el-button type="primary" @click="test">test</el-button>
56
61
  </div>
57
62
  </div>
58
63
  </template>
@@ -2,7 +2,7 @@
2
2
  * @Author: canlong.shen
3
3
  * @Date: 2023-05-24 11:09:59
4
4
  * @LastEditors: canlong.shen
5
- * @LastEditTime: 2023-05-25 10:25:51
5
+ * @LastEditTime: 2023-05-29 18:48:45
6
6
  * @FilePath: \common\src\components\bsgoal-base-select\index.vue
7
7
  * @Description: Select 公共组件
8
8
  *
@@ -11,7 +11,7 @@
11
11
  <script setup>
12
12
  /* setup模板
13
13
  ---------------------------------------------------------------- */
14
- import { ref } from 'vue'
14
+ import { ref, watchEffect } from 'vue'
15
15
 
16
16
  defineOptions({
17
17
  name: 'BsgoalBaseSelect'
@@ -48,7 +48,16 @@ const props = defineProps({
48
48
  }
49
49
  })
50
50
 
51
- const emits = defineEmits(['update:modelValue','change'])
51
+ const emits = defineEmits(['update:modelValue', 'change'])
52
+
53
+ // ---> S 值绑定 <---
54
+
55
+ const selectValue = ref('')
56
+ watchEffect(() => {
57
+ selectValue.value = props.modelValue
58
+ })
59
+
60
+ // ---> E 值绑定 <---
52
61
 
53
62
  // ---> S 触发 方法 <---
54
63
 
@@ -64,7 +73,7 @@ const triggerChange = (value = '') => {
64
73
  const data = finder ? finder.data : null
65
74
 
66
75
  emits('update:modelValue', value)
67
- emits('change', value , data)
76
+ emits('change', value, data)
68
77
  }
69
78
 
70
79
  // ---> E 触发 方法 <---
@@ -74,7 +83,7 @@ const triggerChange = (value = '') => {
74
83
  <el-select
75
84
  clearable
76
85
  class="base_select"
77
- :model-value="modelValue"
86
+ v-model="selectValue"
78
87
  :no-data-text="none"
79
88
  :placeholder="placeholder"
80
89
  @change="triggerChange"