getting-started.en-US.65e472d9.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. import{_ as e,a as s,n as t,k as a}from"./index.c1b9962e.js";const o={pageData:{title:"Getting Started",description:"",frontmatter:{},headers:[{level:2,title:"Playground",slug:"playground",content:"The following CodeSandbox demo is the simplest use case, and it's also a good habit to fork this demo to provide a re-producible demo while reporting a bug."},{level:2,title:"Import ant-design-vue",slug:"import-ant-design-vue",content:"1. Installation"},{level:3,title:"1. Installation",slug:"_1-installation",content:"[vue-cli](https://github.com/vuejs/vue-cli)"},{level:3,title:"2. Create a New Project",slug:"_2-create-a-new-project",content:"A new project can be created using CLI tools."},{level:3,title:"3. Use antd's Components",slug:"_3-use-antd-s-components",content:""},{level:3,title:"4. Component list",slug:"_4-component-list",content:"[Component list](https://github.com/vueComponent/ant-design-vue/blob/next/components/components.ts)"},{level:2,title:"Compatibility",slug:"compatibility",content:"Ant Design Vue 2.x supports all the modern browsers. If you want to use IE9+, you can use Ant Design Vue 1.x & Vue 2.x."},{level:2,title:"Import on Demand",slug:"import-on-demand",content:"we can import individual components on demand:"},{level:2,title:"Customization",slug:"customization",content:""},{level:2,title:"Tips",slug:"tips",content:""}],relativePath:"src/vueDocs/getting-started.en-US.md",content:`# Getting Started
  2. Ant Design Vue is dedicated to providing a **good development experience** for programmers. Make sure that you had installed [Node.js](https://nodejs.org/)(> v8.9) correctly.
  3. > Before delving into Ant Design Vue, a good knowledge base of [Vue](https://cn.vuejs.org/) and [JavaScript ES2015](http://babeljs.io/docs/learn-es2015/) is needed.
  4. ## Playground
  5. The following CodeSandbox demo is the simplest use case, and it's also a good habit to fork this demo to provide a re-producible demo while reporting a bug.
  6. - [![Vue Antd Template](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/agitated-franklin-1w72v)
  7. ## Import ant-design-vue
  8. ### 1. Installation
  9. [vue-cli](https://github.com/vuejs/vue-cli)
  10. \`\`\`bash
  11. $ npm install -g @vue/cli
  12. # OR
  13. $ yarn global add @vue/cli
  14. \`\`\`
  15. ### 2. Create a New Project
  16. A new project can be created using CLI tools.
  17. \`\`\`bash
  18. $ vue create antd-demo
  19. \`\`\`
  20. And, setup your vue project configuration.
  21. ### 3. Use antd's Components
  22. \`\`\`bash
  23. $ npm i --save ant-design-vue@next
  24. \`\`\`
  25. **Fully import**
  26. \`\`\`jsx
  27. import { createApp } from 'vue';
  28. import Antd from 'ant-design-vue';
  29. import App from './App';
  30. import 'ant-design-vue/dist/antd.css';
  31. const app = createApp();
  32. app.config.productionTip = false;
  33. app.use(Antd);
  34. \`\`\`
  35. The above imports Antd entirely. Note that CSS file needs to be imported separately.
  36. **Only import the components you need**
  37. \`\`\`jsx
  38. import { createApp } from 'vue';
  39. import { Button, message } from 'ant-design-vue';
  40. import App from './App';
  41. const app = createApp(App);
  42. app.config.productionTip = false;
  43. /* Automatically register components under Button, such as Button.Group */
  44. app.use(Button).mount('#app');
  45. app.config.globalProperties.$message = message;
  46. \`\`\`
  47. > All the components in antd are listed in the sidebar.
  48. ### 4. Component list
  49. [Component list](https://github.com/vueComponent/ant-design-vue/blob/next/components/components.ts)
  50. ## Compatibility
  51. Ant Design Vue 2.x supports all the modern browsers. If you want to use IE9+, you can use Ant Design Vue 1.x & Vue 2.x.
  52. You need to provide [es5-shim](https://github.com/es-shims/es5-shim) and [es6-shim](https://github.com/paulmillr/es6-shim) and other polyfills for IE browsers.
  53. If you are using babel, we strongly recommend using [babel-polyfill](https://babeljs.io/docs/usage/polyfill/) and [babel-plugin-transform-runtime](https://babeljs.io/docs/plugins/transform-runtime/) instead of those two shims.
  54. > Please avoid using both the babel and shim methods at the same time.
  55. ## Import on Demand
  56. we can import individual components on demand:
  57. \`\`\`jsx
  58. import Button from 'ant-design-vue/lib/button';
  59. import 'ant-design-vue/lib/button/style'; // or ant-design-vue/lib/button/style/css for css format file
  60. \`\`\`
  61. We strongly recommend using [babel-plugin-import](https://github.com/ant-design/babel-plugin-import), which can convert the following code to the 'ant-design-vue/lib/xxx' way:
  62. \`\`\`jsx
  63. import { Button } from 'ant-design-vue';
  64. \`\`\`
  65. And this plugin can load styles too, read [usage](https://github.com/ant-design/babel-plugin-import#usage) for more details.
  66. > FYI, babel-plugin-import's \`style\` option will importing some global reset styles, don't use it if you don't need those styles. You can import styles manually via \`import 'ant-design-vue/dist/antd.css'\` and override the global reset styles.
  67. If you use Vite, you can use [vite-plugin-components](https://github.com/antfu/vite-plugin-components) to load on demand.
  68. ## Customization
  69. - [Customize Theme](/docs/vue/customize-theme)
  70. ## Tips
  71. - You can use any \`npm\` modules.
  72. `,html:`<h1 id="getting-started">Getting Started</h1>
  73. <p>Ant Design Vue is dedicated to providing a <strong>good development experience</strong> for programmers. Make sure that you had installed <a href="https://nodejs.org/" target="_blank" rel="noopener noreferrer">Node.js</a>(&gt; v8.9) correctly.</p>
  74. <blockquote>
  75. <p>Before delving into Ant Design Vue, a good knowledge base of <a href="https://cn.vuejs.org/" target="_blank" rel="noopener noreferrer">Vue</a> and <a href="http://babeljs.io/docs/learn-es2015/" target="_blank" rel="noopener noreferrer">JavaScript ES2015</a> is needed.</p>
  76. </blockquote>
  77. <h2 id="playground">Playground</h2>
  78. <p>The following CodeSandbox demo is the simplest use case, and it's also a good habit to fork this demo to provide a re-producible demo while reporting a bug.</p>
  79. <ul>
  80. <li><a href="https://codesandbox.io/s/agitated-franklin-1w72v" target="_blank" rel="noopener noreferrer"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="Vue Antd Template"></a></li>
  81. </ul>
  82. <h2 id="import-ant-design-vue">Import ant-design-vue</h2>
  83. <h3 id="_1-installation">1. Installation</h3>
  84. <p><a href="https://github.com/vuejs/vue-cli" target="_blank" rel="noopener noreferrer">vue-cli</a></p>
  85. <pre class="language-bash" v-pre><code>$ <span class="token function">npm</span> <span class="token function">install</span> <span class="token parameter variable">-g</span> @vue/cli
  86. <span class="token comment"># OR</span>
  87. $ <span class="token function">yarn</span> global <span class="token function">add</span> @vue/cli
  88. </code></pre>
  89. <h3 id="_2-create-a-new-project">2. Create a New Project</h3>
  90. <p>A new project can be created using CLI tools.</p>
  91. <pre class="language-bash" v-pre><code>$ vue create antd-demo
  92. </code></pre>
  93. <p>And, setup your vue project configuration.</p>
  94. <h3 id="_3-use-antd-s-components">3. Use antd's Components</h3>
  95. <pre class="language-bash" v-pre><code>$ <span class="token function">npm</span> i <span class="token parameter variable">--save</span> ant-design-vue@next
  96. </code></pre>
  97. <p><strong>Fully import</strong></p>
  98. <pre class="language-jsx" v-pre><code><span class="token keyword">import</span> <span class="token punctuation">{</span> createApp <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'vue'</span><span class="token punctuation">;</span>
  99. <span class="token keyword">import</span> Antd <span class="token keyword">from</span> <span class="token string">'ant-design-vue'</span><span class="token punctuation">;</span>
  100. <span class="token keyword">import</span> App <span class="token keyword">from</span> <span class="token string">'./App'</span><span class="token punctuation">;</span>
  101. <span class="token keyword">import</span> <span class="token string">'ant-design-vue/dist/antd.css'</span><span class="token punctuation">;</span>
  102. <span class="token keyword">const</span> app <span class="token operator">=</span> <span class="token function">createApp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  103. app<span class="token punctuation">.</span>config<span class="token punctuation">.</span>productionTip <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
  104. app<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>Antd<span class="token punctuation">)</span><span class="token punctuation">;</span>
  105. </code></pre>
  106. <p>The above imports Antd entirely. Note that CSS file needs to be imported separately.</p>
  107. <p><strong>Only import the components you need</strong></p>
  108. <pre class="language-jsx" v-pre><code><span class="token keyword">import</span> <span class="token punctuation">{</span> createApp <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'vue'</span><span class="token punctuation">;</span>
  109. <span class="token keyword">import</span> <span class="token punctuation">{</span> Button<span class="token punctuation">,</span> message <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'ant-design-vue'</span><span class="token punctuation">;</span>
  110. <span class="token keyword">import</span> App <span class="token keyword">from</span> <span class="token string">'./App'</span><span class="token punctuation">;</span>
  111. <span class="token keyword">const</span> app <span class="token operator">=</span> <span class="token function">createApp</span><span class="token punctuation">(</span>App<span class="token punctuation">)</span><span class="token punctuation">;</span>
  112. app<span class="token punctuation">.</span>config<span class="token punctuation">.</span>productionTip <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
  113. <span class="token comment">/* Automatically register components under Button, such as Button.Group */</span>
  114. app<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>Button<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">mount</span><span class="token punctuation">(</span><span class="token string">'#app'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  115. app<span class="token punctuation">.</span>config<span class="token punctuation">.</span>globalProperties<span class="token punctuation">.</span>$message <span class="token operator">=</span> message<span class="token punctuation">;</span>
  116. </code></pre>
  117. <blockquote>
  118. <p>All the components in antd are listed in the sidebar.</p>
  119. </blockquote>
  120. <h3 id="_4-component-list">4. Component list</h3>
  121. <p><a href="https://github.com/vueComponent/ant-design-vue/blob/next/components/components.ts" target="_blank" rel="noopener noreferrer">Component list</a></p>
  122. <h2 id="compatibility">Compatibility</h2>
  123. <p>Ant Design Vue 2.x supports all the modern browsers. If you want to use IE9+, you can use Ant Design Vue 1.x &amp; Vue 2.x.</p>
  124. <p>You need to provide <a href="https://github.com/es-shims/es5-shim" target="_blank" rel="noopener noreferrer">es5-shim</a> and <a href="https://github.com/paulmillr/es6-shim" target="_blank" rel="noopener noreferrer">es6-shim</a> and other polyfills for IE browsers.</p>
  125. <p>If you are using babel, we strongly recommend using <a href="https://babeljs.io/docs/usage/polyfill/" target="_blank" rel="noopener noreferrer">babel-polyfill</a> and <a href="https://babeljs.io/docs/plugins/transform-runtime/" target="_blank" rel="noopener noreferrer">babel-plugin-transform-runtime</a> instead of those two shims.</p>
  126. <blockquote>
  127. <p>Please avoid using both the babel and shim methods at the same time.</p>
  128. </blockquote>
  129. <h2 id="import-on-demand">Import on Demand</h2>
  130. <p>we can import individual components on demand:</p>
  131. <pre class="language-jsx" v-pre><code><span class="token keyword">import</span> Button <span class="token keyword">from</span> <span class="token string">'ant-design-vue/lib/button'</span><span class="token punctuation">;</span>
  132. <span class="token keyword">import</span> <span class="token string">'ant-design-vue/lib/button/style'</span><span class="token punctuation">;</span> <span class="token comment">// or ant-design-vue/lib/button/style/css for css format file</span>
  133. </code></pre>
  134. <p>We strongly recommend using <a href="https://github.com/ant-design/babel-plugin-import" target="_blank" rel="noopener noreferrer">babel-plugin-import</a>, which can convert the following code to the 'ant-design-vue/lib/xxx' way:</p>
  135. <pre class="language-jsx" v-pre><code><span class="token keyword">import</span> <span class="token punctuation">{</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'ant-design-vue'</span><span class="token punctuation">;</span>
  136. </code></pre>
  137. <p>And this plugin can load styles too, read <a href="https://github.com/ant-design/babel-plugin-import#usage" target="_blank" rel="noopener noreferrer">usage</a> for more details.</p>
  138. <blockquote>
  139. <p>FYI, babel-plugin-import's <code>style</code> option will importing some global reset styles, don't use it if you don't need those styles. You can import styles manually via <code>import 'ant-design-vue/dist/antd.css'</code> and override the global reset styles.</p>
  140. </blockquote>
  141. <p>If you use Vite, you can use <a href="https://github.com/antfu/vite-plugin-components" target="_blank" rel="noopener noreferrer">vite-plugin-components</a> to load on demand.</p>
  142. <h2 id="customization">Customization</h2>
  143. <ul>
  144. <li><a href="/docs/vue/customize-theme.html">Customize Theme</a></li>
  145. </ul>
  146. <h2 id="tips">Tips</h2>
  147. <ul>
  148. <li>You can use any <code>npm</code> modules.</li>
  149. </ul>
  150. `,lastUpdated:1748059052828}},p={class:"markdown"};function i(l,n,r,c,u,d){return a(),s("article",p,n[0]||(n[0]=[t(`<h1 id="getting-started">Getting Started</h1><p>Ant Design Vue is dedicated to providing a <strong>good development experience</strong> for programmers. Make sure that you had installed <a href="https://nodejs.org/" target="_blank" rel="noopener noreferrer">Node.js</a>(&gt; v8.9) correctly.</p><blockquote><p>Before delving into Ant Design Vue, a good knowledge base of <a href="https://cn.vuejs.org/" target="_blank" rel="noopener noreferrer">Vue</a> and <a href="http://babeljs.io/docs/learn-es2015/" target="_blank" rel="noopener noreferrer">JavaScript ES2015</a> is needed.</p></blockquote><h2 id="playground">Playground</h2><p>The following CodeSandbox demo is the simplest use case, and it&#39;s also a good habit to fork this demo to provide a re-producible demo while reporting a bug.</p><ul><li><a href="https://codesandbox.io/s/agitated-franklin-1w72v" target="_blank" rel="noopener noreferrer"><img src="https://codesandbox.io/static/img/play-codesandbox.svg" alt="Vue Antd Template"></a></li></ul><h2 id="import-ant-design-vue">Import ant-design-vue</h2><h3 id="_1-installation">1. Installation</h3><p><a href="https://github.com/vuejs/vue-cli" target="_blank" rel="noopener noreferrer">vue-cli</a></p><pre class="language-bash"><code>$ <span class="token function">npm</span> <span class="token function">install</span> <span class="token parameter variable">-g</span> @vue/cli
  151. <span class="token comment"># OR</span>
  152. $ <span class="token function">yarn</span> global <span class="token function">add</span> @vue/cli
  153. </code></pre><h3 id="_2-create-a-new-project">2. Create a New Project</h3><p>A new project can be created using CLI tools.</p><pre class="language-bash"><code>$ vue create antd-demo
  154. </code></pre><p>And, setup your vue project configuration.</p><h3 id="_3-use-antd-s-components">3. Use antd&#39;s Components</h3><pre class="language-bash"><code>$ <span class="token function">npm</span> i <span class="token parameter variable">--save</span> ant-design-vue@next
  155. </code></pre><p><strong>Fully import</strong></p><pre class="language-jsx"><code><span class="token keyword">import</span> <span class="token punctuation">{</span> createApp <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&#39;vue&#39;</span><span class="token punctuation">;</span>
  156. <span class="token keyword">import</span> Antd <span class="token keyword">from</span> <span class="token string">&#39;ant-design-vue&#39;</span><span class="token punctuation">;</span>
  157. <span class="token keyword">import</span> App <span class="token keyword">from</span> <span class="token string">&#39;./App&#39;</span><span class="token punctuation">;</span>
  158. <span class="token keyword">import</span> <span class="token string">&#39;ant-design-vue/dist/antd.css&#39;</span><span class="token punctuation">;</span>
  159. <span class="token keyword">const</span> app <span class="token operator">=</span> <span class="token function">createApp</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  160. app<span class="token punctuation">.</span>config<span class="token punctuation">.</span>productionTip <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
  161. app<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>Antd<span class="token punctuation">)</span><span class="token punctuation">;</span>
  162. </code></pre><p>The above imports Antd entirely. Note that CSS file needs to be imported separately.</p><p><strong>Only import the components you need</strong></p><pre class="language-jsx"><code><span class="token keyword">import</span> <span class="token punctuation">{</span> createApp <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&#39;vue&#39;</span><span class="token punctuation">;</span>
  163. <span class="token keyword">import</span> <span class="token punctuation">{</span> Button<span class="token punctuation">,</span> message <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&#39;ant-design-vue&#39;</span><span class="token punctuation">;</span>
  164. <span class="token keyword">import</span> App <span class="token keyword">from</span> <span class="token string">&#39;./App&#39;</span><span class="token punctuation">;</span>
  165. <span class="token keyword">const</span> app <span class="token operator">=</span> <span class="token function">createApp</span><span class="token punctuation">(</span>App<span class="token punctuation">)</span><span class="token punctuation">;</span>
  166. app<span class="token punctuation">.</span>config<span class="token punctuation">.</span>productionTip <span class="token operator">=</span> <span class="token boolean">false</span><span class="token punctuation">;</span>
  167. <span class="token comment">/* Automatically register components under Button, such as Button.Group */</span>
  168. app<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span>Button<span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">mount</span><span class="token punctuation">(</span><span class="token string">&#39;#app&#39;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
  169. app<span class="token punctuation">.</span>config<span class="token punctuation">.</span>globalProperties<span class="token punctuation">.</span>$message <span class="token operator">=</span> message<span class="token punctuation">;</span>
  170. </code></pre><blockquote><p>All the components in antd are listed in the sidebar.</p></blockquote><h3 id="_4-component-list">4. Component list</h3><p><a href="https://github.com/vueComponent/ant-design-vue/blob/next/components/components.ts" target="_blank" rel="noopener noreferrer">Component list</a></p><h2 id="compatibility">Compatibility</h2><p>Ant Design Vue 2.x supports all the modern browsers. If you want to use IE9+, you can use Ant Design Vue 1.x &amp; Vue 2.x.</p><p>You need to provide <a href="https://github.com/es-shims/es5-shim" target="_blank" rel="noopener noreferrer">es5-shim</a> and <a href="https://github.com/paulmillr/es6-shim" target="_blank" rel="noopener noreferrer">es6-shim</a> and other polyfills for IE browsers.</p><p>If you are using babel, we strongly recommend using <a href="https://babeljs.io/docs/usage/polyfill/" target="_blank" rel="noopener noreferrer">babel-polyfill</a> and <a href="https://babeljs.io/docs/plugins/transform-runtime/" target="_blank" rel="noopener noreferrer">babel-plugin-transform-runtime</a> instead of those two shims.</p><blockquote><p>Please avoid using both the babel and shim methods at the same time.</p></blockquote><h2 id="import-on-demand">Import on Demand</h2><p>we can import individual components on demand:</p><pre class="language-jsx"><code><span class="token keyword">import</span> Button <span class="token keyword">from</span> <span class="token string">&#39;ant-design-vue/lib/button&#39;</span><span class="token punctuation">;</span>
  171. <span class="token keyword">import</span> <span class="token string">&#39;ant-design-vue/lib/button/style&#39;</span><span class="token punctuation">;</span> <span class="token comment">// or ant-design-vue/lib/button/style/css for css format file</span>
  172. </code></pre><p>We strongly recommend using <a href="https://github.com/ant-design/babel-plugin-import" target="_blank" rel="noopener noreferrer">babel-plugin-import</a>, which can convert the following code to the &#39;ant-design-vue/lib/xxx&#39; way:</p><pre class="language-jsx"><code><span class="token keyword">import</span> <span class="token punctuation">{</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">&#39;ant-design-vue&#39;</span><span class="token punctuation">;</span>
  173. </code></pre><p>And this plugin can load styles too, read <a href="https://github.com/ant-design/babel-plugin-import#usage" target="_blank" rel="noopener noreferrer">usage</a> for more details.</p><blockquote><p>FYI, babel-plugin-import&#39;s <code>style</code> option will importing some global reset styles, don&#39;t use it if you don&#39;t need those styles. You can import styles manually via <code>import &#39;ant-design-vue/dist/antd.css&#39;</code> and override the global reset styles.</p></blockquote><p>If you use Vite, you can use <a href="https://github.com/antfu/vite-plugin-components" target="_blank" rel="noopener noreferrer">vite-plugin-components</a> to load on demand.</p><h2 id="customization">Customization</h2><ul><li><a href="/docs/vue/customize-theme.html">Customize Theme</a></li></ul><h2 id="tips">Tips</h2><ul><li>You can use any <code>npm</code> modules.</li></ul>`,41)]))}var g=e(o,[["render",i]]);export{g as default};