Former-commit-id: d947e54093471ecc85fe9171d51aa64ad560ba9e [formerly d947e54093471ecc85fe9171d51aa64ad560ba9e [formerly d947e54093471ecc85fe9171d51aa64ad560ba9e [formerly d947e54093471ecc85fe9171d51aa64ad560ba9e [formerly 0639e27228bd4ce7583671ac6c5d1702c75c57b9 [formerly c263545cb8457cb5b8194fdbe6393a9e38ad26a6]]]]] Former-commit-id: 7a51bd5d5340e8df7112dedf6fb4bcc3209bf6ea Former-commit-id: b0e44c55c5a159403518bc96eeaab4ddce82b379 Former-commit-id: d061577549c79468a84ac65e541110d512de97e8 [formerly 7a35d2d01c56d0520cf62edc02cc5630d0232b49] Former-commit-id: 0aae62a7688da3c9b63b88e2c3416ec4faa8735a Former-commit-id: 2f1c380beb8720f3aa8e50099f467bd55a7f2259 Former-commit-id: 5b8f973daa4f9f9de742bf832784f8a86f037a9d Former-commit-id: 09933084b7cbc32ff54f0f158aecc352061e158d Former-commit-id: 445510e39e959b6b0451d1d47c6427f16361cd87
109 lines
2.6 KiB
Vue
109 lines
2.6 KiB
Vue
<template>
|
|
<div class="container-component" :class="{responsive}" ref="container">
|
|
<!-- [card] 卡片容器 -->
|
|
<el-card v-if="type === 'card'" shadow="never" class="d2-container-card d2-mr">
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
|
<slot/>
|
|
</el-card>
|
|
<!-- [ghost] 隐形的容器 -->
|
|
<div v-if="type === 'ghost'" class="d2-container-ghost">
|
|
<el-card v-if="$slots.header">
|
|
<slot name="header"/>
|
|
</el-card>
|
|
<slot/>
|
|
</div>
|
|
<!-- [container-full] 填充 -->
|
|
<d2-container-full v-if="type === 'full' && !scroll">
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
|
<slot/>
|
|
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
|
</d2-container-full>
|
|
<!-- [container-full-bs] 填充 滚动优化 -->
|
|
<d2-container-full-bs v-if="type === 'full' && scroll">
|
|
<slot v-if="$slots.header" name="header" slot="header"/>
|
|
<slot/>
|
|
<slot v-if="$slots.footer" name="footer" slot="footer"/>
|
|
</d2-container-full-bs>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
// 插件
|
|
import BScroll from 'better-scroll'
|
|
// 组件
|
|
import d2ContainerFull from './components/d2-container-full.vue'
|
|
import d2ContainerFullBs from './components/d2-container-full-bs.vue'
|
|
export default {
|
|
name: 'd2-container',
|
|
props: {
|
|
// 容器样式
|
|
type: {
|
|
type: String,
|
|
required: false,
|
|
default: 'card'
|
|
},
|
|
// 滚动优化
|
|
scroll: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false
|
|
},
|
|
// 是否开启响应式尺寸变化
|
|
responsive: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false
|
|
}
|
|
},
|
|
components: {
|
|
'd2-container-full': d2ContainerFull,
|
|
'd2-container-full-bs': d2ContainerFullBs
|
|
},
|
|
data () {
|
|
return {
|
|
BS: null
|
|
}
|
|
},
|
|
mounted () {
|
|
if (this.type !== 'full') {
|
|
this.BS = new BScroll(this.$refs.container, {
|
|
mouseWheel: true,
|
|
scrollbar: {
|
|
fade: true,
|
|
interactive: false
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
@import '~@/assets/style/public.scss';
|
|
.container-component {
|
|
position: absolute;
|
|
top: 0px;
|
|
bottom: 0px;
|
|
left: 0px;
|
|
right: 0px;
|
|
overflow: hidden;
|
|
}
|
|
@media (min-width: 576px) {
|
|
// 根据你的需要在这里添加样式
|
|
}
|
|
@media (min-width: 768px) {
|
|
// 根据你的需要在这里添加样式
|
|
}
|
|
@media (min-width: 992px) {
|
|
// 根据你的需要在这里添加样式
|
|
}
|
|
// 在大于1920分辨率的时候
|
|
@media (min-width: 1921px) {
|
|
.container-component.responsive {
|
|
margin: 0px auto;
|
|
margin-bottom: 20px;
|
|
max-width: 1920px - 200px;
|
|
}
|
|
}
|
|
</style>
|