Commit b07003e184a2db6146114a12f44de7d64131fc0c

Authored by RemMai
Committed by GitHub
1 parent 45a8eb97

添加v-model:value双向绑定的支持 (#1073)

无需在Change事件中修改绑定的Value。
仅需在属性中设置 v-model:value,选择图标后,value值自动修改。
src/components/Icon/src/IconPicker.vue
... ... @@ -121,7 +121,7 @@
121 121 copy: propTypes.bool.def(false),
122 122 mode: propTypes.oneOf<('svg' | 'iconify')[]>(['svg', 'iconify']).def('iconify'),
123 123 },
124   - emits: ['change'],
  124 + emits: ['change', 'update:value'],
125 125 setup(props, { emit }) {
126 126 const isSvgMode = props.mode === 'svg';
127 127 const icons = isSvgMode ? getSvgIcons() : getIcons();
... ... @@ -148,7 +148,10 @@
148 148  
149 149 watch(
150 150 () => currentSelect.value,
151   - (v) => emit('change', v)
  151 + (v) => {
  152 + emit('update:value', v);
  153 + return emit('change', v);
  154 + }
152 155 );
153 156  
154 157 function handlePageChange(page: number) {
... ...