<html>
<head>
<title>Insert title here</title>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/vue.min.js"></script>
<style type="text/css">
.class1{
200px;
height:200px;
background : yellow;
}
</style>
</head>
<body>
<div id="mymodel">
{{uname}},{{age}}<br/>
<img :src="imgUrl" />
</div>
<div id="app">
<label for="r1">修改颜色</label><input type="checkbox" v-model="class1" id="r1">
<br>
<div v-bind:class="{'class1': class1}"></div>
</div>
</body>
</html>
<script type="text/javascript">
var mymodeltest = new Vue({
el:'#mymodel',
data: {
uname : 'zhangsan',
age : 20,
imgUrl : '${pageContext.request.contextPath}/img/1.jpg'
}
});
//修改HTML样式
new Vue({
el: '#app',
data:{
class1: false
}
});
</script>