Skip to content

Commit

Permalink
fix(input): 修复 Input 组件 切换 type 后不生效的问题
Browse files Browse the repository at this point in the history
修复 Input 组件 切换 type 后不生效的问题
  • Loading branch information
hi-zhaoyeqing committed Jul 10, 2022
1 parent 63b83ea commit 2b23a87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/input/input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineComponent, h, computed } from 'vue';
import { defineComponent, h, computed, watch } from 'vue';
import { BrowseIcon, BrowseOffIcon, CloseCircleFilledIcon } from 'tdesign-icons-vue-next';
import camelCase from 'lodash/camelCase';
import kebabCase from 'lodash/kebabCase';
Expand Down
8 changes: 8 additions & 0 deletions src/input/useInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ export default function useInput(props: TdInputProps, expose: (exposed: Record<s
{ immediate: true },
);

watch(
() => props.type,
(v) => {
renderType.value = v;
},
{ immediate: true },
);

expose({
focus,
blur,
Expand Down

0 comments on commit 2b23a87

Please sign in to comment.