console
const graph = new X6.Graph({
container: document.getElementById('container'),
width: 800,
height: 600
})
const node = graph.addNode({
x: 80,
y: 80,
width: 160,
height: 60,
shape: 'html',
data: {
time: new Date().toString()
},
html: {
render(node) {
const data = node.getData()
return (
`<div>
<span>${data.time}</span>
</div>`
)
},
shouldComponentUpdate(node) {
// 控制节点重新渲染
return node.hasChanged('data')
}
}
})
<script src="https://unpkg.com/@antv/x6@1.7.7/dist/x6.js"></script>
<div id="container"></div>