textEntity = viewer.entities.add({
position: p,
name: "文字实体",
show: true,
label: {
text: "文字",
font: "14px Source Han Sans CN",
fillColor: new Cesium.Color(255, 255, 255, 1),
backgroundColor: new Cesium.Color(0, 0, 0, 0.7),
showBackground: true,
outline: true,
outlineColor: new Cesium.Color(0, 0, 0, 1),
outlineWidth: 10,
show: true,
},
});
我这样添加了label实体
然后我开始修改实体的属性
if (textEntity) {
textEntity.show = true;
textEntity.label.text = commStore.textData.name;
textEntity.label.font = commStore.textData.fontSize + "px Source Han Sans CN";
textEntity.label.outlineWidth = commStore.textData.outWidth;
textEntity.label.outlineColor = commStore.textData.outLineColor;
textEntity.label.fillColor = commStore.textData.textColor;
textEntity.label.backgroundColor = commStore.textData.bgColor;
textEntity.label.show = true;
console.log(textEntity)
} else {
ElMessage.error("找不到实体text");
}
但当我这样修改之后,实体却在页面上消失了,该如何解决呢