提交 1d709bd1 编写于 作者: jlj05024111@163.com's avatar jlj05024111@163.com

feat: 更新模板数据选择-下拉编辑器显示下拉图标

上级 6f477d6d
...@@ -25,6 +25,12 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -25,6 +25,12 @@ export const IBizPickerDropDown = defineComponent({
// 是否是第一次搜索 // 是否是第一次搜索
const isFirstSearch = ref(false); const isFirstSearch = ref(false);
// 鼠标是否进入
const isEnter = ref(false);
// 下拉框是否在展开
const vsisible = ref(false);
// 第一次搜索的时候需要保存值,否则回显有问题 // 第一次搜索的时候需要保存值,否则回显有问题
const firstRefValue: Ref<string> = ref(''); const firstRefValue: Ref<string> = ref('');
...@@ -146,6 +152,7 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -146,6 +152,7 @@ export const IBizPickerDropDown = defineComponent({
// 下拉关闭的时候,如果没有选择过,要把回显值重新赋回select // 下拉关闭的时候,如果没有选择过,要把回显值重新赋回select
refValue.value = firstRefValue.value; refValue.value = firstRefValue.value;
} }
vsisible.value = isOpen;
}; };
// 搜索词改变时触发 // 搜索词改变时触发
...@@ -169,6 +176,27 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -169,6 +176,27 @@ export const IBizPickerDropDown = defineComponent({
} }
emit('change', null); emit('change', null);
}; };
const renderIcon = () => {
if (props.value && isEnter.value) {
return (
<i
class='ivu-icon ivu-icon-ios-close-circle ivu-select-arrow'
onClick={onClear}
></i>
);
}
return <i class='ivu-icon ivu-icon-ios-arrow-down ivu-select-arrow'></i>;
};
const onMouseEnter = () => {
isEnter.value = true;
};
const onMouseLevel = () => {
isEnter.value = false;
};
return { return {
ns, ns,
c, c,
...@@ -180,6 +208,9 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -180,6 +208,9 @@ export const IBizPickerDropDown = defineComponent({
onClear, onClear,
onSelect, onSelect,
onSearch, onSearch,
renderIcon,
onMouseEnter,
onMouseLevel,
}; };
}, },
render(h) { render(h) {
...@@ -189,7 +220,11 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -189,7 +220,11 @@ export const IBizPickerDropDown = defineComponent({
); );
} }
return ( return (
<div class={[this.ns.b(), this.disabled ? this.ns.m('disabled') : '']}> <div
class={[this.ns.b(), this.disabled ? this.ns.m('disabled') : '']}
onMouseenter={this.onMouseEnter}
onMouseleave={this.onMouseLevel}
>
{[ {[
this.readonly && this.value, this.readonly && this.value,
!this.readonly && !this.readonly &&
...@@ -226,6 +261,7 @@ export const IBizPickerDropDown = defineComponent({ ...@@ -226,6 +261,7 @@ export const IBizPickerDropDown = defineComponent({
}), }),
], ],
), ),
this.renderIcon(),
]} ]}
</div> </div>
); );
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册