getting-started.en-US.fd99f3f6.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. import{_ as s,a,q as t,k as e}from"./index.3fe853a6.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:"Install"},{level:3,title:"4. Component list",slug:"_4-Component-list",content:"[Component list](https://github.com/vueComponent/ant-design-vue/blob/main/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:""}],relativePath:"site/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://www.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. #### Install
  23. \`\`\`bash
  24. $ npm i --save ant-design-vue
  25. \`\`\`
  26. #### Component Registration
  27. If you use Vue's default template syntax, you need to register components before you can use them. There are three ways to register components:
  28. **Global Registration All Components**
  29. \`\`\`jsx
  30. import { createApp } from 'vue';
  31. import Antd from 'ant-design-vue';
  32. import App from './App';
  33. import 'ant-design-vue/dist/antd.css';
  34. const app = createApp(App);
  35. app.use(Antd).mount('#app');
  36. \`\`\`
  37. The above imports Antd entirely. Note that CSS file needs to be imported separately.
  38. **Global Registration Some Components**
  39. \`\`\`jsx
  40. import { createApp } from 'vue';
  41. import { Button, message } from 'ant-design-vue';
  42. import App from './App';
  43. const app = createApp(App);
  44. /* Automatically register components under Button, such as Button.Group */
  45. app.use(Button).mount('#app');
  46. app.config.globalProperties.$message = message;
  47. \`\`\`
  48. **Local Registration**
  49. In this way, component sub-components, such as Button and ButtonGroup, need to be registered separately, and they are only valid in the current component after registration. Therefore, we recommend using the above two methods.
  50. \`\`\`html
  51. <template>
  52. <a-button>Add</a-button>
  53. </template>
  54. <script>
  55. import { Button } from 'ant-design-vue';
  56. const ButtonGroup = Button.Group;
  57. export default {
  58. components: {
  59. AButton: Button,
  60. AButtonGroup: ButtonGroup,
  61. },
  62. };
  63. </script>
  64. \`\`\`
  65. ### 4. Component list
  66. [Component list](https://github.com/vueComponent/ant-design-vue/blob/main/components/components.ts)
  67. ## Compatibility
  68. 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.
  69. ## Import on Demand
  70. we can import individual components on demand:
  71. \`\`\`jsx
  72. import Button from 'ant-design-vue/lib/button';
  73. import 'ant-design-vue/lib/button/style'; // or ant-design-vue/lib/button/style/css for css format file
  74. \`\`\`
  75. 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:
  76. \`\`\`jsx
  77. import { Button } from 'ant-design-vue';
  78. \`\`\`
  79. And this plugin can load styles too, read [usage](https://github.com/ant-design/babel-plugin-import#usage) for more details.
  80. > 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.
  81. If you use Vite, you can use [unplugin-vue-components](https://github.com/antfu/unplugin-vue-components) to load on demand. However, this plugin can only deal with components. Others such as message should be loaded manually:
  82. \`\`\`ts
  83. import { message } from 'ant-design-vue';
  84. import 'ant-design-vue/es/message/style/css'; //use ant-design-vue/es instead of ant-design-vue/lib
  85. \`\`\`
  86. ## Customization
  87. - [Customize Theme](/docs/vue/customize-theme)
  88. `,html:`<h1 id="Getting-Started">Getting Started <a class="header-anchor" href="#Getting-Started">
  89. <span aria-hidden="true" class="anchor">#</span>
  90. </a></h1>
  91. <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>
  92. <blockquote>
  93. <p>Before delving into Ant Design Vue, a good knowledge base of <a href="https://www.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>
  94. </blockquote>
  95. <h2 id="Playground">Playground <a class="header-anchor" href="#Playground">
  96. <span aria-hidden="true" class="anchor">#</span>
  97. </a></h2>
  98. <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>
  99. <ul>
  100. <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>
  101. </ul>
  102. <h2 id="Import-ant-design-vue">Import ant-design-vue <a class="header-anchor" href="#Import-ant-design-vue">
  103. <span aria-hidden="true" class="anchor">#</span>
  104. </a></h2>
  105. <h3 id="_1-Installation">1. Installation <a class="header-anchor" href="#_1-Installation">
  106. <span aria-hidden="true" class="anchor">#</span>
  107. </a></h3>
  108. <p><a href="https://github.com/vuejs/vue-cli" target="_blank" rel="noopener noreferrer">vue-cli</a></p>
  109. <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
  110. <span class="token comment"># OR</span>
  111. $ <span class="token function">yarn</span> global <span class="token function">add</span> @vue/cli
  112. </code></pre>
  113. <h3 id="_2-Create-a-New-Project">2. Create a New Project <a class="header-anchor" href="#_2-Create-a-New-Project">
  114. <span aria-hidden="true" class="anchor">#</span>
  115. </a></h3>
  116. <p>A new project can be created using CLI tools.</p>
  117. <pre class="language-bash" v-pre><code>$ vue create antd-demo
  118. </code></pre>
  119. <p>And, setup your vue project configuration.</p>
  120. <h3 id="_3-Use-antd-s-Components">3. Use antd's Components <a class="header-anchor" href="#_3-Use-antd-s-Components">
  121. <span aria-hidden="true" class="anchor">#</span>
  122. </a></h3>
  123. <h4 id="Install">Install <a class="header-anchor" href="#Install">
  124. <span aria-hidden="true" class="anchor">#</span>
  125. </a></h4>
  126. <pre class="language-bash" v-pre><code>$ <span class="token function">npm</span> i <span class="token parameter variable">--save</span> ant-design-vue
  127. </code></pre>
  128. <h4 id="Component-Registration">Component Registration <a class="header-anchor" href="#Component-Registration">
  129. <span aria-hidden="true" class="anchor">#</span>
  130. </a></h4>
  131. <p>If you use Vue's default template syntax, you need to register components before you can use them. There are three ways to register components:</p>
  132. <p><strong>Global Registration All Components</strong></p>
  133. <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>
  134. <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>
  135. <span class="token keyword">import</span> App <span class="token keyword">from</span> <span class="token string">'./App'</span><span class="token punctuation">;</span>
  136. <span class="token keyword">import</span> <span class="token string">'ant-design-vue/dist/antd.css'</span><span class="token punctuation">;</span>
  137. <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>
  138. 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><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>
  139. </code></pre>
  140. <p>The above imports Antd entirely. Note that CSS file needs to be imported separately.</p>
  141. <p><strong>Global Registration Some Components</strong></p>
  142. <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>
  143. <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>
  144. <span class="token keyword">import</span> App <span class="token keyword">from</span> <span class="token string">'./App'</span><span class="token punctuation">;</span>
  145. <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>
  146. <span class="token comment">/* Automatically register components under Button, such as Button.Group */</span>
  147. 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>
  148. 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>
  149. </code></pre>
  150. <p><strong>Local Registration</strong></p>
  151. <p>In this way, component sub-components, such as Button and ButtonGroup, need to be registered separately, and they are only valid in the current component after registration. Therefore, we recommend using the above two methods.</p>
  152. <pre class="language-html" v-pre><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>template</span><span class="token punctuation">></span></span>
  153. <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a-button</span><span class="token punctuation">></span></span>Add<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a-button</span><span class="token punctuation">></span></span>
  154. <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>template</span><span class="token punctuation">></span></span>
  155. <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>script</span><span class="token punctuation">></span></span><span class="token script"><span class="token language-javascript">
  156. <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>
  157. <span class="token keyword">const</span> ButtonGroup <span class="token operator">=</span> Button<span class="token punctuation">.</span>Group<span class="token punctuation">;</span>
  158. <span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  159. <span class="token literal-property property">components</span><span class="token operator">:</span> <span class="token punctuation">{</span>
  160. <span class="token literal-property property">AButton</span><span class="token operator">:</span> Button<span class="token punctuation">,</span>
  161. <span class="token literal-property property">AButtonGroup</span><span class="token operator">:</span> ButtonGroup<span class="token punctuation">,</span>
  162. <span class="token punctuation">}</span><span class="token punctuation">,</span>
  163. <span class="token punctuation">}</span><span class="token punctuation">;</span>
  164. </span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>script</span><span class="token punctuation">></span></span>
  165. </code></pre>
  166. <h3 id="_4-Component-list">4. Component list <a class="header-anchor" href="#_4-Component-list">
  167. <span aria-hidden="true" class="anchor">#</span>
  168. </a></h3>
  169. <p><a href="https://github.com/vueComponent/ant-design-vue/blob/main/components/components.ts" target="_blank" rel="noopener noreferrer">Component list</a></p>
  170. <h2 id="Compatibility">Compatibility <a class="header-anchor" href="#Compatibility">
  171. <span aria-hidden="true" class="anchor">#</span>
  172. </a></h2>
  173. <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>
  174. <h2 id="Import-on-Demand">Import on Demand <a class="header-anchor" href="#Import-on-Demand">
  175. <span aria-hidden="true" class="anchor">#</span>
  176. </a></h2>
  177. <p>we can import individual components on demand:</p>
  178. <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>
  179. <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>
  180. </code></pre>
  181. <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>
  182. <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>
  183. </code></pre>
  184. <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>
  185. <blockquote>
  186. <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>
  187. </blockquote>
  188. <p>If you use Vite, you can use <a href="https://github.com/antfu/unplugin-vue-components" target="_blank" rel="noopener noreferrer">unplugin-vue-components</a> to load on demand. However, this plugin can only deal with components. Others such as message should be loaded manually:</p>
  189. <pre class="language-ts" v-pre><code><span class="token keyword">import</span> <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>
  190. <span class="token keyword">import</span> <span class="token string">'ant-design-vue/es/message/style/css'</span><span class="token punctuation">;</span> <span class="token comment">//use ant-design-vue/es instead of ant-design-vue/lib</span>
  191. </code></pre>
  192. <h2 id="Customization">Customization <a class="header-anchor" href="#Customization">
  193. <span aria-hidden="true" class="anchor">#</span>
  194. </a></h2>
  195. <ul>
  196. <li><a href="/docs/vue/customize-theme">Customize Theme</a></li>
  197. </ul>
  198. `,lastUpdated:1748060301810}},p={class:"markdown"};function r(c,n,l,i,u,d){return e(),a("article",p,n[0]||(n[0]=[t(`<h1 id="Getting-Started">Getting Started <a class="header-anchor" href="#Getting-Started"><span aria-hidden="true" class="anchor">#</span></a></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://www.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 <a class="header-anchor" href="#Playground"><span aria-hidden="true" class="anchor">#</span></a></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 <a class="header-anchor" href="#Import-ant-design-vue"><span aria-hidden="true" class="anchor">#</span></a></h2><h3 id="_1-Installation">1. Installation <a class="header-anchor" href="#_1-Installation"><span aria-hidden="true" class="anchor">#</span></a></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
  199. <span class="token comment"># OR</span>
  200. $ <span class="token function">yarn</span> global <span class="token function">add</span> @vue/cli
  201. </code></pre><h3 id="_2-Create-a-New-Project">2. Create a New Project <a class="header-anchor" href="#_2-Create-a-New-Project"><span aria-hidden="true" class="anchor">#</span></a></h3><p>A new project can be created using CLI tools.</p><pre class="language-bash"><code>$ vue create antd-demo
  202. </code></pre><p>And, setup your vue project configuration.</p><h3 id="_3-Use-antd-s-Components">3. Use antd&#39;s Components <a class="header-anchor" href="#_3-Use-antd-s-Components"><span aria-hidden="true" class="anchor">#</span></a></h3><h4 id="Install">Install <a class="header-anchor" href="#Install"><span aria-hidden="true" class="anchor">#</span></a></h4><pre class="language-bash"><code>$ <span class="token function">npm</span> i <span class="token parameter variable">--save</span> ant-design-vue
  203. </code></pre><h4 id="Component-Registration">Component Registration <a class="header-anchor" href="#Component-Registration"><span aria-hidden="true" class="anchor">#</span></a></h4><p>If you use Vue&#39;s default template syntax, you need to register components before you can use them. There are three ways to register components:</p><p><strong>Global Registration All Components</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>
  204. <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>
  205. <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>
  206. <span class="token keyword">import</span> <span class="token string">&#39;ant-design-vue/dist/antd.css&#39;</span><span class="token punctuation">;</span>
  207. <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>
  208. 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><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>
  209. </code></pre><p>The above imports Antd entirely. Note that CSS file needs to be imported separately.</p><p><strong>Global Registration Some Components</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>
  210. <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>
  211. <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>
  212. <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>
  213. <span class="token comment">/* Automatically register components under Button, such as Button.Group */</span>
  214. 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>
  215. 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>
  216. </code></pre><p><strong>Local Registration</strong></p><p>In this way, component sub-components, such as Button and ButtonGroup, need to be registered separately, and they are only valid in the current component after registration. Therefore, we recommend using the above two methods.</p><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>template</span><span class="token punctuation">&gt;</span></span>
  217. <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>a-button</span><span class="token punctuation">&gt;</span></span>Add<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>a-button</span><span class="token punctuation">&gt;</span></span>
  218. <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>template</span><span class="token punctuation">&gt;</span></span>
  219. <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>script</span><span class="token punctuation">&gt;</span></span><span class="token script"><span class="token language-javascript">
  220. <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>
  221. <span class="token keyword">const</span> ButtonGroup <span class="token operator">=</span> Button<span class="token punctuation">.</span>Group<span class="token punctuation">;</span>
  222. <span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  223. <span class="token literal-property property">components</span><span class="token operator">:</span> <span class="token punctuation">{</span>
  224. <span class="token literal-property property">AButton</span><span class="token operator">:</span> Button<span class="token punctuation">,</span>
  225. <span class="token literal-property property">AButtonGroup</span><span class="token operator">:</span> ButtonGroup<span class="token punctuation">,</span>
  226. <span class="token punctuation">}</span><span class="token punctuation">,</span>
  227. <span class="token punctuation">}</span><span class="token punctuation">;</span>
  228. </span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>script</span><span class="token punctuation">&gt;</span></span>
  229. </code></pre><h3 id="_4-Component-list">4. Component list <a class="header-anchor" href="#_4-Component-list"><span aria-hidden="true" class="anchor">#</span></a></h3><p><a href="https://github.com/vueComponent/ant-design-vue/blob/main/components/components.ts" target="_blank" rel="noopener noreferrer">Component list</a></p><h2 id="Compatibility">Compatibility <a class="header-anchor" href="#Compatibility"><span aria-hidden="true" class="anchor">#</span></a></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><h2 id="Import-on-Demand">Import on Demand <a class="header-anchor" href="#Import-on-Demand"><span aria-hidden="true" class="anchor">#</span></a></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>
  230. <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>
  231. </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>
  232. </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/unplugin-vue-components" target="_blank" rel="noopener noreferrer">unplugin-vue-components</a> to load on demand. However, this plugin can only deal with components. Others such as message should be loaded manually:</p><pre class="language-ts"><code><span class="token keyword">import</span> <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>
  233. <span class="token keyword">import</span> <span class="token string">&#39;ant-design-vue/es/message/style/css&#39;</span><span class="token punctuation">;</span> <span class="token comment">//use ant-design-vue/es instead of ant-design-vue/lib</span>
  234. </code></pre><h2 id="Customization">Customization <a class="header-anchor" href="#Customization"><span aria-hidden="true" class="anchor">#</span></a></h2><ul><li><a href="/docs/vue/customize-theme">Customize Theme</a></li></ul>`,42)]))}const m=s(o,[["render",r]]);export{m as default};