@uiw/doc
Version:
UIW documentation website.
2 lines • 6.18 kB
JavaScript
(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5877],{4934:e=>{function n(e){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}n.keys=()=>[],n.resolve=n,n.id=4934,e.exports=n},5301:(e,n,t)=>{"use strict";t.d(n,{Z:()=>m});var r=t(8573),i=t(6320),o=t(8563),s=t(7622),a=t(7937);const l={docinfo:"index_docinfo__3Vx8S",markdown:"index_markdown__hcQCp",markdownWrap:"index_markdownWrap__t60jR"};var u=t(4760);function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{path:n}=e,t=/^http/.test(n||"")?n:"https://github.com/uiwjs/uiw/blob/master/".concat(n);return(0,u.jsxs)("div",{className:l.docinfo,children:["\u72af\u4e86\u9519\u8bef\u8fd8\u662f\u60f3\u5bf9\u6587\u4ef6\u505a\u51fa\u8d21\u732e\uff1f",t&&(0,u.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",children:"\u5728Github\u4e0a\u7f16\u8f91\u672c\u9875\uff01"}),(0,u.jsx)("br",{}),(0,u.jsx)("a",{href:"https://github.com/uiwjs/uiw/issues",target:"_blank",rel:"noopener noreferrer",children:"\u53cd\u9988\u5efa\u8bae"}),(0,u.jsx)(a.Divider,{type:"vertical"}),(0,u.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/uiwjs/uiw/issues/new",children:"\u63d0\u4ea4bug"}),(0,u.jsx)(a.Divider,{type:"vertical"}),(0,u.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/uiwjs/uiw",children:"Github"}),(0,u.jsx)(a.Divider,{type:"vertical"}),(0,u.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/kktjs/kkt",children:"kkt"}),(0,u.jsx)(a.Divider,{type:"vertical"}),(0,u.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/kktjs/kkt-ssr",children:"@kkt/ssr"}),(0,u.jsx)(a.Divider,{type:"vertical"}),(0,u.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"http://uiw.gitee.io",children:"\u56fd\u5185\u955c\u50cf"})]})}const p=i.ZP.Preview,d=i.ZP.Code,h=i.ZP.Toolbar,b=e=>{var n,t;let{node:s,components:a,data:l,...c}=e;const b=(0,r.useRef)(null),{headings:m,headingsList:g,...j}=c;(0,r.useEffect)((()=>{if(b.current){const e=b.current.parentElement;e&&e.parentElement&&e.parentElement.replaceChild(b.current,e)}}),[b]);const f=null===s||void 0===s||null===(n=s.position)||void 0===n?void 0:n.start.line,k=null===s||void 0===s||null===(t=s.data)||void 0===t?void 0:t.meta,w=(0,o.Mx)(k)||String(f),x=a["".concat(w)];if(w&&"function"===typeof x){const e=l[w].value||"",n=(0,o.aE)(k||"");return(0,u.jsxs)(i.ZP,{ref:b,children:[(0,u.jsx)(p,{style:{background:n.bg||"transparent"},children:(0,u.jsx)(x,{})}),(0,u.jsx)(h,{text:e,children:n.title||"Example"}),(0,u.jsx)(d,{children:(0,u.jsx)("pre",{...j})})]})}return(0,u.jsx)("code",{...j})};function m(e){return(0,u.jsxs)(r.Fragment,{children:[(0,u.jsx)(s.Z,{className:l.markdownWrap,source:e.source||"",disableCopy:!0,wrapperElement:{"data-color-mode":"light"},components:{code:n=>(0,u.jsx)(b,{...e,...n})}}),(0,u.jsx)(c,{path:e.path})]})}},7498:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>s});const r={components:{},data:{},source:"\u6309\u9700\u52a0\u8f7d\n===\n\n\u9ed8\u8ba4 [`uiw`](https://github.com/uiwjs) \u652f\u6301\u57fa\u4e8e ES module \u7684 Tree Shaking\uff0c\u4e0d\u4f7f\u7528\u4ee5\u4e0b\u63d2\u4ef6\u4e5f\u4f1a\u6709\u6309\u9700\u52a0\u8f7d\u7684\u6548\u679c\uff0c\u8fd9\u662f\u4e3a\u4e86\u89e3\u51b3\u5728\u751f\u4ea7\u73af\u5883\u6587\u4ef6\u4f53\u79ef\u8fc7\u5927\u7684\u95ee\u9898\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u6253\u5305\u5de5\u5177\u7684 Tree Shaking \u529f\u80fd\u53bb\u6389\u6587\u4ef6\u4e2d\u65e0\u7528\u7684\u4ee3\u7801\u3002\n\n> - [Tree Shaking in Rollup](https://rollupjs.org/guide/en/#tree-shaking)\n> - [Tree Shaking in Webpack](https://webpack.js.org/guides/tree-shaking/)\n\nTree Shaking \u662f\u4e00\u4e2a\u672f\u8bed\uff0c\u901a\u5e38\u7528\u4e8e\u63cf\u8ff0\u79fb\u9664 JavaScript \u4e0a\u4e0b\u6587\u4e2d\u7684\u672a\u5f15\u7528\u4ee3\u7801(dead-code)\u3002\u5b83\u4f9d\u8d56\u4e8e ES2015 \u6a21\u5757\u8bed\u6cd5\u7684 \u9759\u6001\u7ed3\u6784 \u7279\u6027\uff0c\u4f8b\u5982 [import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import) \u548c [export](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export)\u3002\u8fd9\u4e2a\u672f\u8bed\u548c\u6982\u5ff5\u5b9e\u9645\u4e0a\u662f\u7531 ES2015 \u6a21\u5757\u6253\u5305\u5de5\u5177 [Rollup](https://github.com/rollup/rollup) \u666e\u53ca\u8d77\u6765\u7684\u3002\n\n\u5982\u679c\u60a8\u5f53\u524d\u7684\u5f00\u53d1\u73af\u5883\u4e0d\u652f\u6301 Tree Shaking, \u53ef\u4ee5\u91c7\u7528\u4ee5\u4e0b\u4e24\u79cd\u65b9\u6848\u3002\n\n\n## \u624b\u52a8\u5f15\u5165\n\n\u624b\u52a8\u5f15\u5165\uff0c\u9700\u8981\u5728\u5199\u4ee3\u7801\u7684\u65f6\u5019\u5c31\u53ea\u5f15\u5165\u7528\u5230\u7684\u6587\u4ef6\n\n```js\nimport Button from 'uiw/lib/cjs/button';\n```\n\n\u5f15\u5165\u5bf9\u5e94\u7684\u6837\u5f0f\u6587\u4ef6:\n\n```diff\nimport Button from 'uiw/lib/cjs/button';\n+ import 'uiw/lib/cjs/button/style/index.less'; // \u5f15\u5165\u9ed8\u8ba4\u6837\u5f0f less\n```\n\n\u52a0\u8f7d ES module \u7ec4\u4ef6\uff0c\u4e0d\u9700\u8981\u52a0\u8f7d\u6837\u5f0f\uff0c\u5c06\u81ea\u52a8\u5728\u4ee3\u7801\u4e2d\u52a0\u8f7d\u6837\u5f0f\u3002\n\n```js\nimport Button from 'uiw/lib/esm/button';\n```\n\n> \u7ec4\u4ef6\u5305\u540d\u89c4\u5219 `CopyToClipboard` > `copy-to-clipboard`\n\n## Babel \u63d2\u4ef6\u6765\u89e3\u51b3\n\n\u5728 Babel \u7f16\u8bd1\u9636\u6bb5\u901a\u8fc7\u63d2\u4ef6 [`@uiwjs/babel-plugin-transform-uiw-import`](https://github.com/uiwjs/babel-plugin-transform-uiw-import) \u628a\u4ee3\u7801\u8f6c\u6362\u6210\u6309\u9700\u5f15\u5165\u7684\u65b9\u5f0f\n\n\u901a\u8fc7 `.babelrc` \u6216 `babel-loader` \u8bbe\u7f6e\u3002\n\n```js\n{\n \"plugins\": [\n [\"babel-plugin-transform-uiw-import\"]\n ]\n}\n```\n\n\u793a\u4f8b\uff1a\n\n```js\n// \u8f6c\u6362\u4e4b\u524d:\nimport { Button } from 'uiw';\n\n// Babel \u6700\u7ec8\u8f6c\u6362\u4e3a\nvar _Button = require('uiw/lib/cjs/button');\n```",headings:[],headingsList:[]};var i=t(5301),o=t(4760);function s(){return(0,o.jsx)(i.Z,{...r,path:"https://github.com/uiwjs/uiw/tree/master/website/src/routes/guide/import/README.md"})}}}]);
//# sourceMappingURL=5877.43e926a2.chunk.js.map