Browse Source

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

无需在Change事件中修改绑定的Value。
仅需在属性中设置 v-model:value,选择图标后,value值自动修改。
pull/1082/head
RemMai 5 years ago
committed by GitHub
parent
commit
b07003e184
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/components/Icon/src/IconPicker.vue

7
src/components/Icon/src/IconPicker.vue

@ -121,7 +121,7 @@
copy: propTypes.bool.def(false),
mode: propTypes.oneOf<('svg' | 'iconify')[]>(['svg', 'iconify']).def('iconify'),
},
emits: ['change'],
emits: ['change', 'update:value'],
setup(props, { emit }) {
const isSvgMode = props.mode === 'svg';
const icons = isSvgMode ? getSvgIcons() : getIcons();
@ -148,7 +148,10 @@
watch(
() => currentSelect.value,
(v) => emit('change', v)
(v) => {
emit('update:value', v);
return emit('change', v);
}
);
function handlePageChange(page: number) {

Loading…
Cancel
Save