fix:样式修改; #42

Merged
yangws merged 1 commits from yangws_ws into main 2024-11-19 09:42:56 +08:00
3 changed files with 55 additions and 25 deletions

View File

@ -68,19 +68,33 @@ const rightComponets = (str) => {
default: default:
return null return null
} }
}
//
const getViewportHeight = () => {
return Math.max(
document.documentElement.clientHeight,
window.innerHeight || 0
);
} }
// //
onMounted(() => { onMounted(() => {
currentComponent.value = rightComponets(props.parameter.components) currentComponent.value = rightComponets(props.parameter.components)
// //
pageHeight.value = getViewportHeight() - 210
nextTick(() => { nextTick(() => {
pageHeight.value = window.innerHeight + window.scrollY - 156; window.addEventListener('resize', () => {
pageHeight.value = getViewportHeight() - 210;
});
}); });
}) })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.tabs-container{ .tabs-container{
position: relative; position: relative;
height: 100%;
}
.demo-tabs{
height: 100%;
} }
.button-div{ .button-div{
position: absolute; position: absolute;
@ -88,9 +102,13 @@ onMounted(() => {
right: 0; right: 0;
z-index: 999; z-index: 999;
} }
.tempalte-main{
height: 100%;
}
.right-box{ .right-box{
background-color: #fff; background-color: #fff;
padding:5px; padding:5px;
border-radius: 4px; border-radius: 4px;
height: 100%;
} }
</style> </style>

View File

@ -1,23 +1,25 @@
<template> <template>
<div class="list-container"> <el-scrollbar :height="viewportHeight">
<div class="list-container">
<div class="content-list" v-for="(item, index) in items" :key="index" @click="handleClick(item)"> <div class="content-list" v-for="(item, index) in items" :key="index" @click="handleClick(item)">
<div class="item-content"> <div class="item-content">
<el-checkbox v-model="item.checked" @click.stop="clickCheckbox(item)"/> <el-checkbox v-model="item.checked" @click.stop="clickCheckbox(item)"/>
<div class="item-text"> <div class="item-text">
<div class="title-header"> <div class="title-header">
<div class="item-title" :title="item.title">{{ item.title }}</div> <div class="item-title" :title="item.title">{{ item.title }}</div>
<CustomButton :item="{ type: item.type, text: item.text, plain: true }" /> <CustomButton :item="{ type: item.type, text: item.text, plain: true }" />
</div> </div>
<div class="item-description" :title="item.description">{{ item.description }}</div> <div class="item-description" :title="item.description">{{ item.description }}</div>
</div> </div>
<el-icon class="item-icon"><ArrowRight /></el-icon> <el-icon class="item-icon"><ArrowRight /></el-icon>
</div> </div>
</div> </div>
</div> </div>
</el-scrollbar>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'; import { ref,onMounted,nextTick } from 'vue';
import { ArrowRight } from '@element-plus/icons-vue'; import { ArrowRight } from '@element-plus/icons-vue';
import CustomButton from '../components/button.vue' import CustomButton from '../components/button.vue'
const emits = defineEmits(['checked']); const emits = defineEmits(['checked']);
@ -30,10 +32,14 @@
{ id:5,title: '沁园春-长沙 习题训练作业', description: '沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业',checked:false,type:'default',text:'习题训练' }, { id:5,title: '沁园春-长沙 习题训练作业', description: '沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业',checked:false,type:'default',text:'习题训练' },
{ id:6,title: '沁园春-长沙 习题训练作业', description: '沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业',checked:false,type:'default',text:'习题训练' }, { id:6,title: '沁园春-长沙 习题训练作业', description: '沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业',checked:false,type:'default',text:'习题训练' },
{ id:7,title: '沁园春-长沙 习题训练作业', description: '沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业',checked:false,type:'default',text:'习题训练' }, { id:7,title: '沁园春-长沙 习题训练作业', description: '沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业',checked:false,type:'default',text:'习题训练' },
{ id:7,title: '沁园春-长沙 习题训练作业', description: '沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业',checked:false,type:'default',text:'习题训练' },
{ id:7,title: '沁园春-长沙 习题训练作业', description: '沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业',checked:false,type:'default',text:'习题训练' },
{ id:7,title: '沁园春-长沙 习题训练作业', description: '沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业沁园春-长沙 习题训练作业',checked:false,type:'default',text:'习题训练' },
]); ]);
// checkboxid // checkboxid
const selectIds = ref([]) const selectIds = ref([])
const viewportHeight = ref(0);
const handleClick = (item) => { const handleClick = (item) => {
console.log(item.title); console.log(item.title);
@ -50,6 +56,21 @@
} }
emits('checked',selectIds.value) emits('checked',selectIds.value)
} }
//
const getViewportHeight = () => {
return Math.max(
document.documentElement.clientHeight,
window.innerHeight || 0
);
}
onMounted(() => {
viewportHeight.value = getViewportHeight() - 157
nextTick(() => {
window.addEventListener('resize', () => {
viewportHeight.value = getViewportHeight() - 157;
});
});
})
</script> </script>
<style scoped> <style scoped>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="page-template flex"> <div class="page-template flex">
<!-- // --> <!-- 顶部 -->
<div class="mb-4"> <div class="mb-4">
<div> <div>
<el-button type="danger" :disabled="!isChceked">批量删除</el-button> <el-button type="danger" :disabled="!isChceked">批量删除</el-button>
@ -12,7 +12,7 @@
@select-click="selectClick" @select-click="selectClick"
/> />
</div> </div>
<div :style="{height: viewportHeight - 72 + 'px'}" class="no-horizontal-scroll"> <div>
<el-row :gutter="20" class="tempalte-main"> <el-row :gutter="20" class="tempalte-main">
<el-col :span="6"> <el-col :span="6">
<!-- 左侧列表 --> <!-- 左侧列表 -->
@ -99,17 +99,8 @@ const listeners = computed(() => ({
.page-template { .page-template {
flex-direction: column; flex-direction: column;
height: 100%;
overflow-x: hidden; //
.tempalte-main { .tempalte-main {
flex: 1; flex: 1;
} }
} }
.no-horizontal-scroll {
overflow: auto;
overflow-x: hidden;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* Internet Explorer 10+ */
}
</style> </style>