diff --git a/src/icon/README.md b/src/icon/README.md index a3b919bb..94358686 100644 --- a/src/icon/README.md +++ b/src/icon/README.md @@ -44,4 +44,9 @@ export default { } }; -``` \ No newline at end of file +``` + +#### TODO + +- 图标内容 +- 按需加载包过大问题 \ No newline at end of file diff --git a/src/icon/icon.vue b/src/icon/icon.vue index 154f6996..a74c1c54 100644 --- a/src/icon/icon.vue +++ b/src/icon/icon.vue @@ -1,15 +1,10 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icon/iconfont.js b/src/icon/iconfont.js index f9eb2d69..43a32e3c 100644 --- a/src/icon/iconfont.js +++ b/src/icon/iconfont.js @@ -1,17 +1,14 @@ -/* eslint-disable */ +import str from './svg'; -!(function (i) { - let c, - l = '', - h = (c = document.getElementsByTagName("script"))[c.length - 1].getAttribute("data-injectcss"); if (h && !i.__iconfont__svg__cssinject__) { i.__iconfont__svg__cssinject__ = !0; try { document.write(""); } catch (c) { console && console.log(c); } }!(function (c) { - if (document.addEventListener) if (~["complete", "loaded", "interactive"].indexOf(document.readyState))setTimeout(c, 0); else { var h = function () { document.removeEventListener("DOMContentLoaded", h, !1), c(); }; document.addEventListener("DOMContentLoaded", h, !1); } else document.attachEvent && (l = c, s = i.document, o = !1, t = function () { o || (o = !0, l()); }, (a = function () { try { s.documentElement.doScroll("left"); } catch (c) { return void setTimeout(a, 50); }t(); })(), s.onreadystatechange = function () { s.readyState == "complete" && (s.onreadystatechange = null, t()); }); let l, - s, - o, - t, - a; - }(function () { - let c, - h; (c = document.createElement("div")).innerHTML = l, l = null, (h = c.getElementsByTagName("svg")[0]) && (h.setAttribute("aria-hidden", "true"), h.style.position = "absolute", h.style.width = 0, h.style.height = 0, h.style.overflow = "hidden", (function (c, h) { h.firstChild ? (function (c, h) { h.parentNode.insertBefore(c, h); }(c, h.firstChild)) : h.appendChild(c); }(h, document.body))); - })); -}(window)); -/* eslint-endble*/ \ No newline at end of file +let div = document.createElement("div"); +div.innerHTML = str; +let target = div.getElementsByTagName("svg")[0]; + +target.setAttribute("aria-hidden", "true"); + +target.style.position = "absolute"; +target.style.width = 0; +target.style.height = 0; +target.style.overflow = "hidden"; + +document.body.insertBefore(target, document.body.firstChild); \ No newline at end of file diff --git a/src/icon/svg.js b/src/icon/svg.js new file mode 100644 index 00000000..09b9e3a4 --- /dev/null +++ b/src/icon/svg.js @@ -0,0 +1,3 @@ +/* eslint-disable max-len */ +export default ` +`; \ No newline at end of file diff --git a/src/style/core/iconfont.scss b/src/style/core/iconfont.scss deleted file mode 100644 index 26130116..00000000 --- a/src/style/core/iconfont.scss +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @wya/vc iconfont - */ -@font-face { - font-family: #{$iconfont-css-prefix}; /* project id 542047 */ - src: url($icon-url + '.eot'); - src: url($icon-url + '.eot?#iefix') format('embedded-opentype'), url($icon-url + '.woff') format('woff'), url($icon-url + '.ttf') format('truetype'), url($icon-url + '.svg#iconfont') format('svg'); -} - -.#{$iconfont-css-prefix} { - display: inline-block; - font-style: normal; - vertical-align: baseline; - text-align: center; - text-transform: none; - line-height: 1; - text-rendering: optimizeLegibility; - -webkit-font-smoothing: antialiased; -} - -[class*="#{$iconfont-css-prefix}-"] { - font-family: $iconfont-css-prefix !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -webkit-text-stroke-width: 0.2px; - -moz-osx-font-smoothing: grayscale; -} -.#{$iconfont-css-prefix}-search:before { content: "\e601"; } -.#{$iconfont-css-prefix}-delete:before { content: "\e616"; } -.#{$iconfont-css-prefix}-up:before { content: "\e637"; } -.#{$iconfont-css-prefix}-down:before { content: "\e636"; } -.#{$iconfont-css-prefix}-right:before { content: "\e634"; } -.#{$iconfont-css-prefix}-left:before { content: "\e635"; } -.#{$iconfont-css-prefix}-rotate-left:before { content: "\e602"; } -.#{$iconfont-css-prefix}-rotate-right:before { content: "\e600"; } -.#{$iconfont-css-prefix}-image:before { content: "\e694"; } -.#{$iconfont-css-prefix}-preview:before { content: "\e60d"; } -.#{$iconfont-css-prefix}-divider:before { content: "\e7b0"; } -.#{$iconfont-css-prefix}-success:before { content: "\e619"; } -.#{$iconfont-css-prefix}-warn:before { content: "\e61a"; } -.#{$iconfont-css-prefix}-error:before { content: "\e937"; } -.#{$iconfont-css-prefix}-loading:before { content: "\e79e"; } -.#{$iconfont-css-prefix}-close:before { content: "\e612"; } - -.icon { - width: 1em; - height: 1em; - vertical-align: -0.15em; - fill: currentColor; - overflow: hidden; -} diff --git a/src/style/index.scss b/src/style/index.scss index 43cad13e..63907f43 100644 --- a/src/style/index.scss +++ b/src/style/index.scss @@ -1,3 +1,2 @@ @import "mixins/index"; @import "themes/index"; -@import "core/iconfont";