标签:lse title pad add tps app alt .com cli
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>changeColor</title>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<style>
span{
background: lightcoral;
display: inline-block;
padding: 10px;
color: #fff;
margin: 10px 0;
}
.changeColor span{
background: lightgreen;
}
</style>
<body>
<div id="app">
<div :class="{changeColor}" @click="changeColor =! changeColor">
<span>Hello</span>
</div>
</div>
<script>
new Vue({
el: '#app',
data: {
changeColor: false
},
methods: {
}
})
</script>
</body>
</html>
效果如下:
来回切换颜色
标签:lse title pad add tps app alt .com cli
原文地址:https://www.cnblogs.com/guangzan/p/10304613.html