@
whitev2 css 对象 class 对象可以抽出来,放到别的位置.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="js/vue.js"></script>
</head>
<body>
<div id="test" v-bind:style='[state.isSelect?styles.testSelect:styles.testNoSelect]' v-bind:class='[]'>
</div>
<script>
var test = new Vue ({
el:'#test',
data:{
state:{
isSelect:true
},
styles:{
testSelect:{
'width':'100px',
'height':'100px',
'background-color':'red'
},
testNoSelect:{
'width':'100px',
'height':'100px',
'background-color':'blue'
}
},
classes:{
}
}
});
</script>
</body>
</html>