Merge branch 'v1.4.0' of https://gitee.com/layui/layui-vue into v1.4.0
This commit is contained in:
commit
5f4f601a1c
@ -58,6 +58,7 @@ const currentValue = ref<string>(
|
|||||||
);
|
);
|
||||||
const hasContent = computed(() => (props.modelValue as string)?.length > 0);
|
const hasContent = computed(() => (props.modelValue as string)?.length > 0);
|
||||||
const isPassword = computed(() => type.value == "password");
|
const isPassword = computed(() => type.value == "password");
|
||||||
|
const composing = ref(false);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.type,
|
() => props.type,
|
||||||
@ -85,8 +86,11 @@ watch(
|
|||||||
const onInput = function (event: Event) {
|
const onInput = function (event: Event) {
|
||||||
const inputElement = event.target as HTMLInputElement;
|
const inputElement = event.target as HTMLInputElement;
|
||||||
const value = inputElement.value;
|
const value = inputElement.value;
|
||||||
emit("update:modelValue", value);
|
|
||||||
emit("input", value);
|
emit("input", value);
|
||||||
|
if (composing.value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
emit("update:modelValue", value);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClear = () => {
|
const onClear = () => {
|
||||||
@ -108,6 +112,15 @@ const onBlur = (event: Event) => {
|
|||||||
emit("blur", event);
|
emit("blur", event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onCompositionstart = () => {
|
||||||
|
composing.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const onCompositionend = (event: Event) => {
|
||||||
|
composing.value = false;
|
||||||
|
onInput(event)
|
||||||
|
}
|
||||||
|
|
||||||
const classes = computed(() => {
|
const classes = computed(() => {
|
||||||
return { "layui-disabled": props.disabled };
|
return { "layui-disabled": props.disabled };
|
||||||
});
|
});
|
||||||
@ -150,6 +163,8 @@ const showPassword = () => {
|
|||||||
@change="onChange"
|
@change="onChange"
|
||||||
@focus="onFocus"
|
@focus="onFocus"
|
||||||
@blur="onBlur"
|
@blur="onBlur"
|
||||||
|
@compositionstart="onCompositionstart"
|
||||||
|
@compositionend="onCompositionend"
|
||||||
/>
|
/>
|
||||||
<span class="layui-input-suffix" v-if="slots.suffix || props.suffixIcon">
|
<span class="layui-input-suffix" v-if="slots.suffix || props.suffixIcon">
|
||||||
<slot name="suffix" v-if="slots.suffix"></slot>
|
<slot name="suffix" v-if="slots.suffix"></slot>
|
||||||
|
Loading…
Reference in New Issue
Block a user