diff --git a/src/custom-image-search-box/custom-image-search-box.scss b/src/custom-image-search-box/custom-image-search-box.scss index 29b96607df23a0ea7f5289c6d354ed34a7283420..e269bc226a32558deaf7478808fe4186ed216161 100644 --- a/src/custom-image-search-box/custom-image-search-box.scss +++ b/src/custom-image-search-box/custom-image-search-box.scss @@ -11,10 +11,21 @@ position: absolute; top: 0; left: 0; + @include when('has-img') { + .el-input__wrapper { + box-shadow: unset; - .el-input__wrapper { - box-shadow: unset; + &.is-focus { + box-shadow: unset; + } + + &:hover { + box-shadow: unset; + } + } + } + .el-input__wrapper { .el-input__suffix::before { position: absolute; top: 9px; @@ -26,25 +37,23 @@ background-color: #00e2f4; border-radius: 4px; } - - &.is-focus { - box-shadow: unset; - } - - &:hover { - box-shadow: unset; - } } + } @include e(search-icon) { + position: relative; color: #2ce8e1; cursor: pointer; + @include when('has-img') { + left: -6px; + opacity: 0; + } } } -.cockpit-large-screen{ - .ibiz-custom-image-search-box{ +.cockpit-large-screen { + .ibiz-custom-image-search-box { position: absolute; } -} \ No newline at end of file +} diff --git a/src/custom-image-search-box/custom-image-search-box.tsx b/src/custom-image-search-box/custom-image-search-box.tsx index 10f4418a47d0256af00c759e62943b6c119c55f7..f3c2e9fa06a93a9f966301ae081b6d9aac8e559c 100644 --- a/src/custom-image-search-box/custom-image-search-box.tsx +++ b/src/custom-image-search-box/custom-image-search-box.tsx @@ -11,20 +11,35 @@ export const CustomImageSearchBox = defineComponent({ name: 'CustomImageSearchBox', props: getRawProps(), emits: getEditorEmits(), - setup(props, { emit }) { + setup(props) { const ns = useNamespace('custom-image-search-box'); const c = props.controller; + // 搜索值 const searchValue = ref(''); + // 是否配置了图片 + const hasImg = ref(false); + + // 搜索 const onSearch = (): void => { - emit('customEvent', { tag: 'SEARCH', value: searchValue.value }); + if (props.controller.dashboard) { + const Dc = props.controller.dashboard; + if (Dc) { + Dc.refresh({ query: searchValue.value }); + } + } }; + if (c.model.sysImage?.rawContent) { + hasImg.value = true; + } + return { c, ns, searchValue, + hasImg, onSearch, }; }, @@ -37,19 +52,24 @@ export const CustomImageSearchBox = defineComponent({ this.readonly ? this.ns.m('readonly') : '', ]} > - + {this.hasImg && ( + + )} }