@kine-design/core 0.0.1-beta.3 → 0.0.1-beta.4
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.
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* 3. debounce:输入停止后延迟触发搜索,避免频繁请求
|
|
13
13
|
* 4. loading 状态:搜索进行中显示加载指示
|
|
14
14
|
*/
|
|
15
|
-
import { ref, toRef, onBeforeUnmount } from 'vue';
|
|
15
|
+
import { ref, toRef, watch, onBeforeUnmount } from 'vue';
|
|
16
16
|
import { AutoCompleteProps, AutoCompleteOption } from './props';
|
|
17
17
|
|
|
18
18
|
export function useAutoComplete(props: AutoCompleteProps, ctx: any) {
|
|
@@ -21,6 +21,13 @@ export function useAutoComplete(props: AutoCompleteProps, ctx: any) {
|
|
|
21
21
|
// --- 状态 ---
|
|
22
22
|
/** 输入框当前文本,与 modelValue 保持同步 */
|
|
23
23
|
const inputValue = ref(modelValueRef.value);
|
|
24
|
+
|
|
25
|
+
// 外部 modelValue 变化时同步到 inputValue(编辑回填等场景)
|
|
26
|
+
watch(modelValueRef, (v) => {
|
|
27
|
+
if (v !== inputValue.value) {
|
|
28
|
+
inputValue.value = v;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
24
31
|
/** 下拉是否展开 */
|
|
25
32
|
const isOpen = ref(false);
|
|
26
33
|
/** 搜索进行中 */
|
|
@@ -60,5 +60,11 @@ export declare type InputNumberProps = {
|
|
|
60
60
|
* @type string
|
|
61
61
|
* @default ''
|
|
62
62
|
*/
|
|
63
|
-
placeholder?: string
|
|
63
|
+
placeholder?: string,
|
|
64
|
+
/**
|
|
65
|
+
* @description whether to show increase/decrease buttons. 是否显示增减按钮
|
|
66
|
+
* @type boolean
|
|
67
|
+
* @default true
|
|
68
|
+
*/
|
|
69
|
+
controls?: boolean
|
|
64
70
|
};
|
package/dist/core.js
CHANGED
|
@@ -1032,6 +1032,10 @@ var props$39 = {
|
|
|
1032
1032
|
precision: {
|
|
1033
1033
|
type: Number,
|
|
1034
1034
|
default: 0
|
|
1035
|
+
},
|
|
1036
|
+
controls: {
|
|
1037
|
+
type: Boolean,
|
|
1038
|
+
default: true
|
|
1035
1039
|
}
|
|
1036
1040
|
};
|
|
1037
1041
|
//#endregion
|
|
@@ -4872,8 +4876,12 @@ var props$10 = {
|
|
|
4872
4876
|
* 4. loading 状态:搜索进行中显示加载指示
|
|
4873
4877
|
*/
|
|
4874
4878
|
function useAutoComplete(props, ctx) {
|
|
4879
|
+
const modelValueRef = toRef(() => props.modelValue ?? "");
|
|
4875
4880
|
/** 输入框当前文本,与 modelValue 保持同步 */
|
|
4876
|
-
const inputValue = ref(
|
|
4881
|
+
const inputValue = ref(modelValueRef.value);
|
|
4882
|
+
watch(modelValueRef, (v) => {
|
|
4883
|
+
if (v !== inputValue.value) inputValue.value = v;
|
|
4884
|
+
});
|
|
4877
4885
|
/** 下拉是否展开 */
|
|
4878
4886
|
const isOpen = ref(false);
|
|
4879
4887
|
/** 搜索进行中 */
|