Skip to content

Commit f48f757

Browse files
committed
!447 fix(tagInput): 初始化inputValue未反填至输入框
* test: update * fix(tagInput): 初始化inputValue未反填至输入框
1 parent c722232 commit f48f757

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/component/component/tagInput/__tests__/tagInput.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,16 @@ describe("LayTagInput", () => {
193193
expect((component.vm as any).oldCompositionValue).toBe("H");
194194
expect(component.findAll(".layui-tag-text").length).toBe(2);
195195
});
196+
197+
test("inputValue 初始化反填", async () => {
198+
const wrapper = mount(LayTagInput, {
199+
props: {
200+
inputValue: "123",
201+
},
202+
});
203+
204+
const component = wrapper.findComponent(LayTagInput);
205+
const inputInstance = component.find("input");
206+
expect(inputInstance.element.value).toBe("123");
207+
});
196208
});

packages/component/component/tagInput/index.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,10 @@ onMounted(() => {
312312
handleResize();
313313
const treeSelectContext = useTreeSelectProvide();
314314
treeSelectContext?.setInputEl?.(inputRefEl.value as HTMLInputElement);
315+
316+
if (inputRefEl.value) {
317+
inputRefEl.value!.value = inputValue.value;
318+
}
315319
});
316320
317321
defineExpose({

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy