第一次上传
This commit is contained in:
39
src/components/newListLayout/components/listDetails.vue
Normal file
39
src/components/newListLayout/components/listDetails.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button
|
||||
style="margin-right:20px"
|
||||
type="text"
|
||||
:size="$store.getters.size"
|
||||
:icon="value ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
|
||||
@click= "onclockFn(!value)"
|
||||
>
|
||||
{{ value ? "隐藏详情" : "展开详情" }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props:{
|
||||
value:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {}
|
||||
},
|
||||
created(){
|
||||
|
||||
},
|
||||
methods:{
|
||||
onclockFn(e) {
|
||||
this.$emit('input',e)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
38
src/components/newListLayout/components/seachZoom.vue
Normal file
38
src/components/newListLayout/components/seachZoom.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-button
|
||||
type="text"
|
||||
:size="$store.getters.size"
|
||||
:icon="value ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"
|
||||
@click= "onclockFn(!value)"
|
||||
>
|
||||
{{ value ? "隐藏搜索" : "展开搜索" }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props:{
|
||||
value:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
},
|
||||
data(){
|
||||
return {}
|
||||
},
|
||||
created(){
|
||||
|
||||
},
|
||||
methods:{
|
||||
onclockFn(e) {
|
||||
this.$emit('input',e)
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
</style>
|
||||
65
src/components/newListLayout/css/index.css
Normal file
65
src/components/newListLayout/css/index.css
Normal file
@@ -0,0 +1,65 @@
|
||||
|
||||
:root{
|
||||
--newlayout_containerBG:white;
|
||||
--el-input_height:36px;
|
||||
--el-input_line-height:36px;
|
||||
}
|
||||
.newlayout_container{
|
||||
height: calc(100vh - 140px);
|
||||
background-color:var(--newlayout_containerBG);
|
||||
border-radius: 20px;
|
||||
margin-top: 1rem ;
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.el-input--medium .el-input__inner {
|
||||
height:var(--el-input_height) !important;
|
||||
line-height:var(--el-input_line-height) !important;
|
||||
}
|
||||
.el-input{
|
||||
margin-bottom: 16px !important;
|
||||
}
|
||||
.seach{
|
||||
max-height: 100%;
|
||||
overflow: hidden;
|
||||
transition: .5s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.seachbutten_left{
|
||||
flex: 1;
|
||||
}
|
||||
.seachbutten_right{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: end;
|
||||
}
|
||||
.seachbutten{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.listDetails{
|
||||
max-height: 100vh;
|
||||
overflow: hidden;
|
||||
transition: .5s;
|
||||
margin-top: 16px;
|
||||
flex-shrink: 0;
|
||||
|
||||
}
|
||||
.newlayout_list{
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.footerPage{
|
||||
height: 60px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
138
src/components/newListLayout/index/index.vue
Normal file
138
src/components/newListLayout/index/index.vue
Normal file
@@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<div class="newlayout_container">
|
||||
<el-row :style="{
|
||||
maxHeight: isShow.seachZoom ? (assemblyShowSearch ? '' : '50px') : '',
|
||||
}" class="seach" id="seach">
|
||||
<slot name="seach"></slot>
|
||||
</el-row>
|
||||
<el-row class="seachbutten">
|
||||
<div class="seachbutten_left">
|
||||
<slot name="seachbutten_left"></slot>
|
||||
</div>
|
||||
<div class="seachbutten_right">
|
||||
<seachZoom v-model="assemblyShowSearch" v-if="isShow.seachZoom"></seachZoom>
|
||||
<listDetails v-model="listDetails" v-if="isShow.listDetails"></listDetails>
|
||||
<slot name="seachbutten_right"></slot>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-row :style="{
|
||||
maxHeight: isShow.listDetails ? (listDetails ? '' : '0px') : '',
|
||||
}" v-if="isShow.listDetails" class="listDetails" id="listDetails">
|
||||
<slot name="listDetails"> </slot>
|
||||
</el-row>
|
||||
<el-row class="newlayout_list">
|
||||
<slot name="list"></slot>
|
||||
</el-row>
|
||||
<el-row class="footerPage">
|
||||
<slot name="footerPage"></slot>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import seachZoom from "../components/seachZoom.vue";
|
||||
import listDetails from "../components/listDetails.vue";
|
||||
|
||||
export default {
|
||||
name: "newListLayout",
|
||||
components: {
|
||||
seachZoom,
|
||||
listDetails,
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
isShow: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
seachZoom: false, //是否开启搜索折叠
|
||||
listDetails: false, //是否开启列表详情
|
||||
};
|
||||
},
|
||||
},
|
||||
showSearch: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
assemblyShowSearch: false,
|
||||
listDetails: false,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
mounted() {
|
||||
this.initListHeight();
|
||||
this.listenerList()
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler(newVal, oldVal) {
|
||||
//判断newVal有没有值监听路由变化
|
||||
console.log(newVal.name)
|
||||
if(newVal){
|
||||
setTimeout(() => {
|
||||
this.initListHeight()
|
||||
}, 500);
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
listenerList() {
|
||||
let that = this;
|
||||
this.domeChange(["seach", "listDetails"], () => {
|
||||
setTimeout(() => { that.initListHeight() }, 500);
|
||||
});
|
||||
},
|
||||
initListHeight() {
|
||||
let that = this;
|
||||
let seachHeight = document.getElementsByClassName("seach")[0].clientHeight;
|
||||
let listDetailsHeight = that.isShow.listDetails ? document.getElementsByClassName("listDetails")[0].clientHeight : 0;
|
||||
let seachbuttenHeight = document.getElementsByClassName("seachbutten")[0].clientHeight;
|
||||
let newlayout_containerHeight = document.getElementsByClassName("newlayout_container")[0].clientHeight;
|
||||
let listHeight = newlayout_containerHeight - seachbuttenHeight - 60 - seachHeight - listDetailsHeight - 40 - 16;
|
||||
that.$emit("input", listHeight);
|
||||
},
|
||||
domeChange(id, callBack) {
|
||||
const config = {
|
||||
attributes: true,
|
||||
childList: false,
|
||||
subtree: false,
|
||||
characterData: false,
|
||||
};
|
||||
if (typeof id == 'object' && id instanceof Array) {
|
||||
console.log('zhou1')
|
||||
id.forEach((item) => {
|
||||
let itemTargetNode = document.getElementById(item);
|
||||
let mutationObserver = new MutationObserver(callBack);
|
||||
mutationObserver.observe(itemTargetNode, config);
|
||||
});
|
||||
} else {
|
||||
let targetNode = document.getElementById(id);
|
||||
mutationObserver.observe(targetNode, config);
|
||||
}
|
||||
},
|
||||
init() {
|
||||
this.windowChange(this.initListHeight);
|
||||
},
|
||||
windowChange(callBack) {
|
||||
let taht = this;
|
||||
window.addEventListener("resize", () => {
|
||||
callBack ? callBack() : "";
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import url(../css/index.css);
|
||||
</style>
|
||||
Reference in New Issue
Block a user