重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

几种动态设置样式的方法

样式类绑定:

使用对象:
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' } } } 数组语法设置元素样式

分享标题:几种动态设置样式的方法
分享地址:http://cqcxhl.cn/article/jioped.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP