我在我的有角项目中使用cytoscape,当我创建新的细胞图时,我尝试使用一种样式的"background-opacity"
属性,但是当我为项目提供服务时,在编译后它会在控制台中引发错误
ERROR in src/app/graph/graph.component.ts(101,5): error TS2322: Type '({ selector: string; style: { 'background-color': string; label: string; }; } | { selector: string; style: { color: string; "background-color": string; "background-opacity": string; "text-valign": string; label: string; }; } | { ...; })[]' is not assignable to type 'Stylesheet[] | Promise<Stylesheet[]>'.
Type '({ selector: string; style: { 'background-color': string; label: string; }; } | { selector: string; style: { color: string; "background-color": string; "background-opacity": string; "text-valign": string; label: string; }; } | { ...; })[]' is not assignable to type 'Stylesheet[]'.
Type '{ selector: string; style: { 'background-color': string; label: string; }; } | { selector: string; style: { color: string; "background-color": string; "background-opacity": string; "text-valign": string; label: string; }; } | { ...; }' is not assignable to type 'Stylesheet'.
Type '{ selector: string; style: { color: string; "background-color": string; "background-opacity": string; "text-valign": string; label: string; }; }' is not assignable to type 'Stylesheet'.
Type '{ selector: string; style: { color: string; "background-color": string; "background-opacity": string; "text-valign": string; label: string; }; }' is not assignable to type 'StylesheetStyle'.
Types of property 'style' are incompatible.
Type '{ color: string; "background-color": string; "background-opacity": string; "text-valign": string; label: string; }' is not assignable to type 'Node | Edge | Core'.
Type '{ color: string; "background-color": string; "background-opacity": string; "text-valign": string; label: string; }' is not assignable to type 'Node'.
Types of property '"background-opacity"' are incompatible.
Type 'string' is not assignable to type 'PropertyValue<NodeSingular,number>'.
它显示了图形,但一直给我一个错误。当我从样式表中删除属性时,它消失了。 这是我的细胞样式表部分
style: [
{
selector: 'node',style: {
'background-color': 'black',label: 'data(id)'
}
},{
selector: '.count',style: {
color: 'white',"background-color": 'black',"background-opacity": '0',"text-valign": 'center',label: 'data(id)'
}
},{
selector: 'edge',style: {
"text-margin-y": '-10',label: 'data(value)'
}
}
]