成都网站建设设计

将想法与焦点和您一起共享

几种动态设置样式的方法

样式类绑定:

使用对象:
computed:{ divClasses:function(){ return { red:this.attachRed, blue:!this.attachRed } } } 使用命名: css中定义.red,.green,.blue样式。
data:{ attachRed:false, color:'greed' } 动态设置样式,不使用CSS类:
computed:{ mystyle:function(){ return { backgroundColor:this.color, width:this.width + 'px' } } } 数组语法设置元素样式

名称栏目:几种动态设置样式的方法
URL地址:http://chengdu.cdxwcx.cn/article/jioped.html