感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vue 测试实例 - 菜鸟教程(runcodex.com)</title>
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
</head>
<body>
<div id="dynamic">
<div v-bind:style="{color: 'red', fontSize: fontSize + 'px'}">可以动态调节</div>
<div v-bind:style="objectStyle"> 不可以动态调节</div>
{{fontSize}}
<button @click="++fontSize">+</button>
<button @click="--fontSize">-</button>
</div>
<script>
var app = new Vue({
el: '#dynamic',
data: {
fontSize: 20,
objectStyle: {
color: 'green',
fontSize: this.fontSize + 'px'
}
})
</script>
</body>
</html>
输入 JavaScript 代码……
xxxxxxxxxx
输入 CSS 代码……