如何使用elemen-ui的row-class-name属性

如题目所示 

这次我使用row-class-name的时候,发现用不了。经过上网搜索,发现只需要去掉<style scoped></style>里的scoped就行了,然而这个东西一旦去了,就有污染他人样式的风险。比如你的页面有个.el-main的样式,恰好其他人的页面有el-main,这样污染是必定会发生的,而且默认的就是<style scoped></style>是必须加scoped的,不能影响到别人。所以这个方法不好。

 其实很简单,只需要在你的样式前面加上/deep/ 就行了。

/deep/.el-col {
		border-radius: 5px;
		margin-bottom: 0px;
		margin-top: 1px;
	}

值得注意的是,必须每个都加上/deep/,这样再使用<style scoped></style>,就没有问题了。

当然有的意见是加两个<style scoped></style><style ></style> 一个带scoped,不过我的vue报错了,暂时不使用这种方法

<style scoped>

</style>

<style >

</style>

猜你喜欢

转载自blog.csdn.net/guapilixianghe/article/details/126365954