(window.webpackJsonp=window.webpackJsonp||[]).push([[75],{1484:function(s,e,t){"use strict";t.r(e);var a=function(){var s=this.$createElement;this._self._c;return this._m(0)};a._withStripped=!0;var n=t(31),r=Object(n.a)({},a,[function(){var s=this,e=s.$createElement,t=s._self._c||e;return t("div",[t("h1",[s._v("Use in vue-cli 3")]),s._v(" "),t("p",[t("a",{attrs:{href:"https://github.com/vuejs/vue-cli"}},[s._v("vue-cli")]),s._v(" is one of the best Vue application development tools. We are going to use "),t("code",{pre:!0},[s._v("antd")]),s._v(" within it and modify the webpack config for some customized needs.")]),s._v(" "),t("h2",{attrs:{id:"Install-and-Initialization"}},[s._v("Install and Initialization "),t("a",{staticClass:"anchor",attrs:{href:"#Install-and-Initialization"}},[s._v("#")])]),s._v(" "),t("p",[s._v("We need to install "),t("code",{pre:!0},[s._v("vue-cli")]),s._v(" first, you may need install "),t("a",{attrs:{href:"https://github.com/yarnpkg/yarn/"}},[s._v("yarn")]),s._v(" too.")]),s._v(" "),t("pre",{pre:!0},[t("code",{pre:!0,attrs:{"v-pre":"",class:"language-bash"}},[s._v("$ npm install -g @vue/cli\n"),t("span",{pre:!0,attrs:{class:"hljs-comment"}},[s._v("# OR")]),s._v("\n$ yarn global add @vue/cli\n")])]),s._v(" "),t("p",[s._v("Create a new project named "),t("code",{pre:!0},[s._v("antd-demo")]),s._v(".")]),s._v(" "),t("pre",{pre:!0},[t("code",{pre:!0,attrs:{"v-pre":"",class:"language-bash"}},[s._v("$ vue create antd-demo\n")])]),s._v(" "),t("p",[s._v("And, setup your vue project configuration.")]),s._v(" "),t("p",[s._v("The tool will create and initialize environment and dependencies automatically, please try config your proxy setting or use another npm registry if any network errors happen during it.")]),s._v(" "),t("p",[s._v("Then we go inside "),t("code",{pre:!0},[s._v("antd-demo")]),s._v(" and start it.")]),s._v(" "),t("pre",{pre:!0},[t("code",{pre:!0,attrs:{"v-pre":"",class:"language-bash"}},[s._v("$ "),t("span",{pre:!0,attrs:{class:"hljs-built_in"}},[s._v("cd")]),s._v(" antd-demo\n$ npm run serve\n")])]),s._v(" "),t("p",[s._v('Open the browser at http://localhost:8080/. It renders a header saying "Welcome to Your Vue.js App" on the page.')]),s._v(" "),t("h2",{attrs:{id:"Import-antd"}},[s._v("Import antd "),t("a",{staticClass:"anchor",attrs:{href:"#Import-antd"}},[s._v("#")])]),s._v(" "),t("p",[s._v("Below is the default directory structure.")]),s._v(" "),t("pre",{pre:!0},[t("code",{pre:!0,attrs:{"v-pre":""}},[s._v("├── README.md\n├── babel.config\n├── package.json\n├── public\n│   ├── favicon.ico\n│   └── index.html\n├── src\n│   ├── assets\n│ │ └── logo.png\n│   ├── components\n│ │ └── HelloWorld.vue\n│   ├── App.vue\n│   └── main.js\n└── yarn.lock\n")])]),s._v(" "),t("p",[s._v("Now we install "),t("code",{pre:!0},[s._v("ant-design-vue")]),s._v(" from yarn or npm.")]),s._v(" "),t("pre",{pre:!0},[t("code",{pre:!0,attrs:{"v-pre":"",class:"language-bash"}},[s._v("$ yarn add ant-design-vue\n")])]),s._v(" "),t("p",[s._v("Modify "),t("code",{pre:!0},[s._v("src/main.js")]),s._v(", import Button component from "),t("code",{pre:!0},[s._v("antd")]),s._v(".")]),s._v(" "),t("pre",{pre:!0},[t("code",{pre:!0,attrs:{"v-pre":"",class:"language-jsx"}},[t("span",{pre:!0,attrs:{class:"hljs-keyword"}},[s._v("import")]),s._v(" Vue "),t("span",{pre:!0,attrs:{class:"hljs-keyword"}},[s._v("from")]),s._v(" "),t("span",{pre:!0,attrs:{class:"hljs-string"}},[s._v("'vue'")]),s._v(";\n"),t("span",{pre:!0,attrs:{class:"hljs-keyword"}},[s._v("import")]),s._v(" Button "),t("span",{pre:!0,attrs:{class:"hljs-keyword"}},[s._v("from")]),s._v(" "),t("span",{pre:!0,attrs:{class:"hljs-string"}},[s._v("'ant-design-vue/lib/button'")]),s._v(";\n"),t("span",{pre:!0,attrs:{class:"hljs-keyword"}},[s._v("import")]),s._v(" "),t("span",{pre:!0,attrs:{class:"hljs-string"}},[s._v("'ant-design-vue/dist/antd.css'")]),s._v(";\n"),t("span",{pre:!0,attrs:{class:"hljs-keyword"}},[s._v("import")]),s._v(" App "),t("span",{pre:!0,attrs:{class:"hljs-keyword"}},[s._v("from")]),s._v(" "),t("span",{pre:!0,attrs:{class:"hljs-string"}},[s._v("'./App'")]),s._v(";\n\nVue.component(Button.name, Button);\n\nVue.config.productionTip = "),t("span",{pre:!0,attrs:{class:"hljs-literal"}},[s._v("false")]),s._v(";\n\n"),t("span",{pre:!0,attrs:{class:"hljs-keyword"}},[s._v("new")]),s._v(" Vue({\n "),t("span",{pre:!0,attrs:{class:"hljs-attr"}},[s._v("render")]),s._v(": "),t("span",{pre:!0,attrs:{class:"hljs-function"}},[t("span",{pre:!0,attrs:{class:"hljs-params"}},[s._v("h")]),s._v(" =>")]),s._v(" h(App),\n}).$mount("),t("span",{pre:!0,attrs:{class:"hljs-string"}},[s._v("'#app'")]),s._v(");\n")])]),s._v(" "),t("p",[s._v("Modify "),t("code",{pre:!0},[s._v("src/App.vue")]),s._v("。")]),s._v(" "),t("pre",{pre:!0},[t("code",{pre:!0,attrs:{"v-pre":"",class:"language-jsx"}},[s._v("