.vue文件的一个小细节

96 阅读1分钟
原文链接: zhuanlan.zhihu.com

top.vue

<template>
	<div class="ds">
		<div class="left">
			<p>SX</p>
		</div>
		<div class="right">
			<p>SB</p>
		</div>
	</div>
</template>

<script>
    console.log("-------------------------");     //只执行一次


    export default {
        props: [],
        data() {
            return {}
        },
        components: {
           
        },
        methods: {

        },
        created() {

        },
        mounted() {
            console.log("???????????$");  //执行多次
        }
    };
</script>

<style lang="scss" scoped="scoped">
	.guize {
		box-sizing: border-box;
		padding: 0 0.4rem;
		margin-top: -0.3rem;
		width: 100%;
		height: 1.2rem;
		font-size: 0.24rem;
		color: white;
		position: relative;
		.left {
			color: #abc4ed;
			float: left;
			transform:scale(0.85);
			transform-origin:0 0; 
			p {
				font-size: 0.24rem;
				line-height: 2;
			}
		}
		.right {
			float: left;
			width: 1.6rem;
			height: 0.44rem;
			line-height: 0.44rem;
			border: 1px solid white;
			color: white;
			border-radius: 0.24rem;
			text-align: center;
			position: absolute;
			right: 0.4rem;
			bottom: 0.04rem;
		}
	}
</style>