vue.js v-cloak防止页面未渲染,vue.js v-cloak使用

vue.js v-cloak防止页面未渲染,vue.js v-cloak使用

 

================================

©Copyright 蕃薯耀 2018年12月07日

http://fanshuyao.iteye.com/

 

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>vue.js v-cloak防止闪现</title>
<style type="text/css">
[v-cloak]{
	display: none;
}
</style>
</head>
<body>
	
	<div id="vueDiv">
		
		<div style="margin-top: 30px;">
			<div>-----使用v-cloak前-----</div>
			<div>{{text2}}</div>
		</div>
		<div style="margin-top: 30px;">
			<div>-----使用v-cloak,防止页面未被Vue渲染前,显示的{{}}:-----</div>
			<div v-cloak>{{text}}</div>
		</div>
		
	</div>

<script type="text/javascript" src="../js/vue.js"></script>
<script type="text/javascript">
var vueObj = new Vue({
	el : "#vueDiv",
	data : {
		text : "这是文本内容",
		text2 : "这是文本内容22222222",
	},
	beforeMount: function(){
		alert("alert");
	}
});
</script>
</body>
</html>

 

================================

©Copyright 蕃薯耀 2018年12月07日

http://fanshuyao.iteye.com/

 

猜你喜欢

转载自fanshuyao.iteye.com/blog/2434866