我想在单击按钮时更改 customData 值,我可以使用 oEvent.getSource().data("key") 获取该值,但如何重置它?
oEvent.getSource().data().key =1
上面的代码不起作用
oEvent.getSource().data("key", null); // or
oEvent.getSource().removeCustomData(sCustomDataId);
Run Code Online (Sandbox Code Playgroud)
或者全部删除:
oEvent.getSource().data(null); // or
oEvent.getSource().destroyCustomData();
Run Code Online (Sandbox Code Playgroud)
oEvent.getSource().data("key", data); // or
oEvent.getSource().addCustomData(new CustomData({ // required from "sap/ui/core/CustomData"
key: "key",
value: data
}));
Run Code Online (Sandbox Code Playgroud)
见这里。
顺便说一句:不建议像您那样访问属性。您应该始终使用 getter/setter。oSource.data().key
归档时间: |
|
查看次数: |
211 次 |
最近记录: |