3 changed files with 108 additions and 39 deletions
@ -1,42 +1,111 @@ |
|||||
<template> |
<template> |
||||
<ElInput v-on="$listeners" :placeholder="placeholder" size="mini" class='InputSearch'> |
<ElPopover placement="bottom" popper-class="global-input-search-popover" :popperOptions="popperOptions" |
||||
<img slot="suffix" src="./search.svg"> |
:visibleArrow="false" :width="this.width" trigger="hover" @show="handleShow"> |
||||
</ElInput> |
<div class='InputSearch' slot="reference" ref="ReferenceInputRef"> |
||||
|
<span>{{ placeholder }}</span> |
||||
|
<img src="./search.svg"> |
||||
|
</div> |
||||
|
|
||||
|
<div style="width: 100%"> |
||||
|
<slot> |
||||
|
<Form class="form" :formList="formList" v-bind="getFormConfigOptions" /> |
||||
|
<ElEmpty description="暂无搜索内容"></ElEmpty> |
||||
|
</slot> |
||||
|
|
||||
|
<div class="footer"> |
||||
|
<Button style="background-color: rgba(0, 179, 204, .3);"> |
||||
|
重置 |
||||
|
</Button> |
||||
|
<Button> |
||||
|
搜索 |
||||
|
</Button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</ElPopover> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
|
import Button from '@screen/components/Buttons/Button.vue'; |
||||
|
import Form from '@screen/components/FormConfig'; |
||||
|
|
||||
export default { |
export default { |
||||
name: 'InputSearch', |
name: 'InputSearch', |
||||
|
components: { |
||||
|
Button, |
||||
|
Form |
||||
|
}, |
||||
props: { |
props: { |
||||
placeholder: { |
placeholder: { |
||||
type: String, |
type: String, |
||||
default: "请点击右侧图标筛选" |
default: "请点击右侧图标筛选" |
||||
|
}, |
||||
|
formConfigOptions: { |
||||
|
type: Object, |
||||
|
default: null |
||||
|
}, |
||||
|
formList: { |
||||
|
type: Array, |
||||
|
default: () => [] |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
width: null, |
||||
|
popperOptions: {} |
||||
|
} |
||||
|
}, |
||||
|
emit: [ |
||||
|
'handleReset', |
||||
|
"handleSearch" |
||||
|
], |
||||
|
computed: { |
||||
|
getFormConfigOptions() { |
||||
|
return { |
||||
|
column: "1", |
||||
|
labelWidth: "120px", |
||||
|
...this.formConfigOptions |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
methods: { |
||||
|
handleShow() { |
||||
|
if (this.width) return; |
||||
|
|
||||
|
this.width = this.$refs.ReferenceInputRef.getBoundingClientRect().width |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
</script> |
</script> |
||||
|
|
||||
|
<style lang='scss'> |
||||
|
div.el-popper.global-input-search-popover { |
||||
|
background: #064258; |
||||
|
|
||||
|
.footer { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: flex-end; |
||||
|
gap: 9px; |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
<style lang='scss' scoped> |
<style lang='scss' scoped> |
||||
.InputSearch { |
.InputSearch { |
||||
height: 26px; |
height: 26px; |
||||
opacity: 1; |
background: linear-gradient(180deg, #005C79 0%, #009BCC 100%) !important; |
||||
|
color: #fff; |
||||
::v-deep { |
border-radius: 2px; |
||||
.el-input__inner { |
display: flex; |
||||
background: linear-gradient(180deg, #005C79 0%, #009BCC 100%) !important; |
align-items: center; |
||||
color: #fff; |
justify-content: space-between; |
||||
border-radius: 2px; |
padding: 3px 15px; |
||||
|
padding-right: 9px; |
||||
&::placeholder { |
cursor: pointer; |
||||
color: #fff; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.el-input__suffix { |
font-size: 12px; |
||||
display: flex; |
font-family: PingFang SC, PingFang SC; |
||||
align-items: center; |
font-weight: 400; |
||||
justify-content: center; |
color: #FFFFFF; |
||||
} |
line-height: 14px; |
||||
} |
|
||||
} |
} |
||||
</style> |
</style> |
||||
|
Loading…
Reference in new issue