<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			.blue{
				color:blue;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<div @click="showHelp">{{msg}}</div>
			<input :type="types" name="user" v-model="msg" value="" />
			<h3 :class="{blue:active}">{{changedMsg}}</h3>
			<h2 @click="changeColor">点击我让上边的切换文字变色</h2>
		</div>
		<script type="text/javascript" charset="utf-8">
			var App=new Vue({
				el:"#app",
				data:{
					msg:"hello world",
					types:"text",
					active:false
				},
				methods:{
					showHelp:function(){
						this.msg="点击之后文字变成这个,输入框也编程了按钮";
						this.types="button"
					},
					changeColor:function(){
						this.active=!this.active;
					}
				},
				computed:{
					changedMsg:function(){
						return this.msg+"我就是新增的,不想和你msg一样";
					}
				}
			})
		</script>
	</body>
</html>

看完一章图就全部了解了大部分vue的api的理解

至于细节看文档就好。

 

 

Logo

前往低代码交流专区

更多推荐