收藏
回答

缩放85%,子元素背景无法完全覆盖父元素?

100% 缩放下正常

85% 缩放下异常

<template>
	<view class="model">
		<view class="left-model">
			<view :class="['nav-item',{ 'active': isActive === index }]" v-for="(item,index) in navList" :key="index">
				<view class="b"></view>
				<view class="b"></view>
				<view class="nav-text" @click="checked(index)">
					{{item.title}}
				</view>
			</view>
		</view>


	</view>
</template>


<script>
	export default {
		data() {
			return {
				isActive: 0,
				navList: [{
						title: '广东',
						child: [{
							url: '/static/logo.png',
							title: '广东测试1'
						}]
					},
					{
						title: "湖南",
						child: [{
							url: '/static/logo.png',
							title: '湖南测试1'
						}]
					},
					{
						title: "福建"
					}
				],
				selecedUrl: null,
				showView: false
			}
		},
		computed: {
			childList: function() {
				return this.navList[this.isActive].child || []
			},
		},
		methods: {
			checked(index) {
				this.isActive = index
			},
			// 点击图片显示全屏
			checkedImage(url) {
				this.showView = true
				this.selecedUrl = url
			},
			// 关闭全屏显示
			checkedHidden() {
				this.showView = false
			}
		}
	}
</script>


<style lang="scss" scoped>
	.model {
		width: 100%;
		height: 100vh;
		display: flex;


		// $back-col: rgb(73, 57, 113);
		// $back-col: #7dbfff;
		// $back-col: #33835F;
		// $back-col: #394264;
		$back-col: #1f253d;
		$right-back-col: #f6f7fb;


		.left-model {
			width: 70px;
			height: 100%;
			overflow-y: auto;
			overflow-x: hidden;
			background-color: $back-col;
			padding-top: 15px;


			.nav-item {
				position: relative;


				.nav-text {
					position: relative;
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: center;
					color: #fff;
					font-size: 1rem;
					padding: 15px 0;
					margin-left: 10px;
					border-top-left-radius: 20px;
					border-bottom-left-radius: 20px;
				}


				.b:nth-child(1) {
					position: absolute;
					top: -15px;
					height: 15px;
					width: 100%;
					background-color: #fff;
					display: none;


					&::before {
						content: "";
						position: absolute;
						top: 0;
						left: 0;
						width: 100%;
						height: 100%;
						border-bottom-right-radius: 20px;
						background-color: $back-col;
					}
				}


				.b:nth-child(2) {
					position: absolute;
					bottom: -15px;
					height: 15px;
					width: 100%;
					background-color: #fff;
					display: none;


					&::before {
						content: "";
						position: absolute;
						top: 0;
						left: 0;
						width: 100%;
						height: 100%;
						border-top-right-radius: 20px;
						background-color: $back-col;
					}
				}
			}


			.active {
				.nav-text {
					text-decoration: none;
					color: #000;
					background-color: rgb(254, 254, 254);
				}


				.b:nth-child(1),
				.b:nth-child(2) {
					display: block;
				}
			}
		}


		}
</style>
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容