需求:根据提供的数据,动态给每一个树节点后面的button赋背景颜色
<el-tree
:data="layertreeData1" node-key="id"
show-checkbox
:props="layerdefaultProps"
:check-on-click-node="true">
<span class="custom-tree-node" slot-scope="{ node }">
<span>{{ node.data.name }}</span>
<span class="layerlegend">
<el-button
circle
disabled
:style="{ 'background-color': node.data.paint['fill-color'] }">
</el-button>
</span></span>
</el-tree>
layertreeData1: [{
id: "1",
name: "test1",
paint: {
"fill-color": "rgba(41, 106, 9, 1)",
"fill-outline-color": "rgba(223, 230, 230, 1)",
}},
{
id: "2",
name: "test2",
paint: {
"fill-color": "rgba(100, 150, 59, 1)",
"fill-outline-color": "rgba(223, 230, 230, 1)",
}}]