我尝试从JointJS元素中读取道具。我可以看到它被添加了,但是我不知道如何读取该值。
var uml = joint.shapes.uml;
var state = new uml.State({
name: "some name",
prop: { myId: "some id" },
events: ["event1", "event2"],
attrs: {
".uml-state-body": {
fill: "rgba(48, 208, 198, 0.1)",
stroke: "rgba(48, 208, 198, 0.5)",
"stroke-width": 1.5
},
".uml-state-separator": {
stroke: "rgba(48, 208, 198, 0.4)"
}
}
});
this.graph.addCell(state);
这不起作用
this.paper.on("element:pointerup ", function(elementView) {
var id = elementView.model.get("myId");
});
答案 0 :(得分:1)
您真的很近...;)
我在吸气剂中使用CATCH
来获得完整路径BEGIN TRY
BEGIN TRANSACTION
/* Do some operations */
/* Execute another SP that might have the following:
BEGIN TRANSACTION
-- Some other operations
COMMIT
*/
COMMIT
END TRY
BEGIN CATCH
DECLARE @v_ErrorMessage VARCHAR(MAX) = ERROR_MESSAGE()
IF @@TRANCOUNT > 0 -- Only rollback if there is an active transaction
ROLLBACK
RAISERROR (@v_ErrorMessage, 16, 1)
END CATCH
胜过您的工作:prop
https://codepen.io/Michal-Miky-Jankovsky/pen/PVXaZy
构造函数中的所有对象键都是吸气剂的“属性”
您可以直接在模型上设置“ myId”:
get("prop").myId
将可按预期使用吸气剂:
elementView.model.get("prop").myId