vue——2

<div ref="hexad">
		 
</div>

vue操作dom
this.$refs.hexad.innerHTML = 'nihao'

vue动画

<template>
	<div id="demo">
		<button v-on:click="show = !show">
			Toogle
		</button>
		<transition name="fade">
			<p v-if="show">hello</p>
		</transition>
	</div>



</template>
<script>
	export default{
		data(){
			return {
				show: true,
			}
		},
		mounted :function() {
		
		},
		methods : {
			
		}

	}
</script>
<style>
	/* 显示 => 隐藏 */
	.fade-leave-active{
		transition: opacity 2s;
	}
	.fade-leave,.fade-enter-to{
		opacity: 1;
	}
	.fade-leave-to,.fade-enter{
		opacity: 0;
	}
	/* 隐藏 => 显示 */
	.fade-enter-active{
		transition: opacity 1s;
	}
</style>

  

猜你喜欢

转载自www.cnblogs.com/cl94/p/12219471.html