子组件使用父组件传入的样式

一般使用行内形式体现
例子

<template>
  <div class="emptyStyle">
    <div class="emptyBox" :style="{ marginTop: top }">
      <div class="pic"></div>
      <div class="wordUp font-tip" :style="{ lineHeight: lineHightUp }">
        {{ lineUp }}
      </div>
      <div class="wordDown font-tip" :style="{ lineHeight: lineHightDown }">
        {{ lineDown }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    lineUp: {
      type: String,
      default: () => ''
    },
    lineDown: {
      type: String,
      default: () => ''
    },
    lineHightUp: {
      type: String,
      default: () => '20px'
    },
    lineHightDown: {
      type: String,
      default: () => '1px'
    },
    top: {
      type: String,
      default: () => '0'
    }
  }
}
</script>

<style lang="scss" scoped>
.emptyStyle {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	.emptyBox {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		// transform: translate(0, -50%);
		.pic {
			width: 80px;
			height: 74px;
			background: url('../assets/image/empty_data.png') center center no-repeat;
		}
		.wordUp {
		}

		.wordDown {
		}
	}
}
</style>

特别注意: element 可能因为层级问题失效
解决办法 , 动态css- 类名 :class=“true?test:’’”

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值