vue打卡02day

<html>
	<head>
		<link rel="stylesheet" href="vueObject.css">
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
	</head>
	<body>
		<!-- 生命周期 -->
		<div id='app'>
			<button v-on:click="a = !a">{{a}}</button>
		</div>
		<!-- 模板语法 -->
		<div id='app01'>
			<span v-once>这个将不会改变:{{msg}}</span>
			<button v-on:click="msg = msg + '+'">{{msg}}</button>
			<span v-html="rawHtml"></span>
			<button v-bind:disabled="isButtonDisabled" v-on:click="isButtonDisabled=!isButtonDisabled">Button</button>
			<button v-bind:disabled="!isButtonDisabled" v-on:click="isButtonDisabled=!isButtonDisabled">Button</button>
			<span>{{ isButtonDisabled ? 'YES' : 'NO' }}</span>
			<p v-if="isButtonDisabled">现在你看到我了</p>
			<!-- 2.6.0才支持
				<a v-bind:[attributeName]="url"> 动态参数 </a>
			-->
			<form v-on:submit.prevent="onSubmit">
				<input type="submit">
			</form>
			<a @click="doSomething">...</a>
			<a :href="url">...</a>
		</div>
		<script src="vueObject.js"></script>
	</body>
</html>
var data={a:true}
var app = new Vue({
	el:'#app',
	data:data,
	created:function(){
		console.log('created a is: ' + data.a)
	},
	updated:function(){
		console.log('updated a is: ' + data.a)
	}
})
var app01 = new Vue({
	el:'#app01',
	data:{
		msg:"hello",
		rawHtml:"<h1>hello</h1>",
		isButtonDisabled:true,
		attributeName:"href",
		url:"http://www.baidu.com/"
	},
	methods:{
		onSubmit:function(){
			console.log('提交表单数据')
		},
		doSomething:function(){
			console.log('a标签跳转')
		}
	},
})
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值