删除先前存储的数据。
datax.removeData(elm, name)
Example: 设置数据,然后再删除。
<!DOCTYPE html> <html> <head> <style> div { margin: 2px;color: blue; } span { color: red;} </style> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [{ name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> <div>value1 after creation: <span></span></div> <div>value1 after removal: <span></span></div> <script> require(["skylark/query", "skylark/finder", "skylark/datax"], function(query, finder, datax) { var div = query("div")[0]; datax.data(div, "test1", "VALUE-1"); query("span:first").text("" + datax.data(div, "test1")); datax.removeData(div, "test1") query("span:last").text("" + datax.data(div, "test1")); }); </script> </body> </html>