feat(ui): 重构高级搜索组件并优化布局
- 重构 AiPullDown 组件,使用 v-model 实现双向绑定 - 优化 AiSearchBar 组件样式和布局 - 调整 AiPage 组件中的滚动条样式
This commit is contained in:
@@ -14,8 +14,11 @@
|
|||||||
export default {
|
export default {
|
||||||
name: "AiPullDown",
|
name: "AiPullDown",
|
||||||
props: {
|
props: {
|
||||||
target: String,
|
value: Boolean,
|
||||||
height: {default: 4},
|
},
|
||||||
|
model: {
|
||||||
|
prop: 'value',
|
||||||
|
event: 'expand'
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -25,32 +28,34 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
handleExpand() {
|
handleExpand() {
|
||||||
this.expand = !this.expand
|
this.expand = !this.expand
|
||||||
if (this.target) {
|
|
||||||
|
|
||||||
} else this.$emit('change', this.expandStyle)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
btnText() {
|
btnText() {
|
||||||
return this.expand ? '收起高级搜索' : '展开高级搜索'
|
return this.expand ? '收起' : '展开'
|
||||||
},
|
|
||||||
expandStyle() {
|
|
||||||
let initStyle = {overflow: 'hidden', height: `${this.height}px`}
|
|
||||||
this.expand && (initStyle.height = "auto")
|
|
||||||
return initStyle
|
|
||||||
},
|
},
|
||||||
expandIcon() {
|
expandIcon() {
|
||||||
return this.expand ? 'iconfont iconDouble_Up' : 'iconfont iconDouble_Down'
|
return this.expand ? 'iconfont iconDouble_Up' : 'iconfont iconDouble_Down'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
watch: {
|
||||||
this.$emit("change", this.expandStyle)
|
expand: {
|
||||||
|
immediate: true, handler(v) {
|
||||||
|
this.$emit('expand', v)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.AiPullDown {
|
.AiPullDown {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 24px;
|
||||||
|
transform: translateY(100%);
|
||||||
|
background-color: #fff;
|
||||||
|
|
||||||
.line {
|
.line {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|||||||
@@ -48,6 +48,12 @@ export default {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
|
|
||||||
|
:deep(.el-scrollbar__wrap) {
|
||||||
|
overflow-x: hidden;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
& > .fill {
|
& > .fill {
|
||||||
&.card {
|
&.card {
|
||||||
padding: 12px 16px 12px;
|
padding: 12px 16px 12px;
|
||||||
@@ -62,9 +68,6 @@ export default {
|
|||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
||||||
:deep(.el-scrollbar__wrap) {
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&.hasFooter {
|
&.hasFooter {
|
||||||
@@ -81,8 +84,8 @@ export default {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
left:0;
|
left: 0;
|
||||||
right:0;
|
right: 0;
|
||||||
height: 64px;
|
height: 64px;
|
||||||
background: #F5F5F5;
|
background: #F5F5F5;
|
||||||
box-shadow: 0 1px 0 0 #E5E5E5;
|
box-shadow: 0 1px 0 0 #E5E5E5;
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<section>
|
<section class="AiSearchBar" :class="{bottomBorder,isSingleRow,expand}">
|
||||||
<div class="AiSearchBar" :class="{bottomBorder}" :style="searchBarStyle">
|
<div ref="AiSearchBarZone" class="searchLeftZone">
|
||||||
<div ref="AiSearchBarZone" class="searchLeftZone">
|
<slot name="left"/>
|
||||||
<slot name="left"/>
|
|
||||||
</div>
|
|
||||||
<div class="searchRightZone" ref="searchRightZone">
|
|
||||||
<slot name="right"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<ai-pull-down v-if="!isSingleRow" @change="handlePullDown" :height="rightHeight"/>
|
<div class="searchRightZone" ref="searchRightZone">
|
||||||
|
<slot name="right"/>
|
||||||
|
</div>
|
||||||
|
<ai-pull-down v-if="!isSingleRow" v-model="expand"/>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -27,7 +25,8 @@ export default {
|
|||||||
height: 0,
|
height: 0,
|
||||||
rightHeight: 0,
|
rightHeight: 0,
|
||||||
searchBarStyle: {},
|
searchBarStyle: {},
|
||||||
observer: null
|
observer: null,
|
||||||
|
expand: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -63,12 +62,24 @@ export default {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
padding-bottom: 12px;
|
padding-bottom: 36px;
|
||||||
|
position: relative;
|
||||||
|
height: 64px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
&.isSingleRow {
|
||||||
|
height: 44px;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
&.bottomBorder {
|
&.bottomBorder {
|
||||||
border-bottom: 1px solid #eee;
|
border-bottom: 1px solid #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.expand {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
:deep(.searchLeftZone ) {
|
:deep(.searchLeftZone ) {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
@@ -76,6 +87,8 @@ export default {
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
//height: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.searchRightZone ) {
|
:deep(.searchRightZone ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user