You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
  7. <link rel="shortcut icon" href="<%= BASE_URL %>favicon.ico">
  8. <title>CRMEB</title>
  9. </head>
  10. <body>
  11. <noscript>
  12. <strong>
  13. 请开启 JavaScript 功能来使用 。
  14. </strong>
  15. </noscript>
  16. <div id="app">
  17. </div>
  18. </body>
  19. <script>
  20. // dataset 方法兼容 IE 浏览器。ie10及以下不支持dataset
  21. if (window.HTMLElement) {
  22. if (Object.getOwnPropertyNames(HTMLElement.prototype).indexOf('dataset') === -1) {
  23. Object.defineProperty(HTMLElement.prototype, 'dataset', {
  24. get: function () {
  25. var attributes = this.attributes // 获取节点的所有属性
  26. var name = []
  27. var value = [] // 定义两个数组保存属性名和属性值
  28. var obj = {} // 定义一个空对象
  29. for (var i = 0; i < attributes.length; i++) { // 遍历节点的所有属性
  30. if (attributes[i].nodeName.slice(0, 5) === 'data-') { // 如果属性名的前面5个字符符合"data-"
  31. // 取出属性名的"data-"的后面的字符串放入name数组中
  32. name.push(attributes[i].nodeName.slice(5));
  33. // 取出对应的属性值放入value数组中
  34. value.push(attributes[i].nodeValue);
  35. }
  36. }
  37. for (var j = 0; j < name.length; j++) { // 遍历name和value数组
  38. obj[name[j]] = value[j]; // 将属性名和属性值保存到obj中
  39. }
  40. return obj // 返回对象
  41. }
  42. })
  43. }
  44. }
  45. </script>
  46. </html>