首先跟着 element 官方文档走一遍
注意把. babelrc 改成这样
- {
- "presets": [["env", { "modules": false}],
- "stage-3"
- ],
- "plugins": [["component", {
- "libraryName": "element-ui",
- "styleLibraryName": "theme-chalk"
- }
- ]]
- }
在 webpack.config.js
- {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: '[name].[ext]'
- }
- }
安装 style-loader 依赖
npm install--save - dev style - loader
再安装 url-loader
npm install--save - dev url - loader
如果安装 less ,less-loader
- cnpm install less less - loader - D
- cnpm install node - sass sass - loader - D
- <style lang="sass" scoped> .....</style>
引用日历组件
在 src 文件夹中新建 components 文件夹 ->Date.vue 复制内容注意 template 内记得用 div 包着
在 App.vue 中 script 标签中
import Date from "./components/Date.vue"``components:{Date}
在 template 插入
<Date></Date > 标签
bower 包管理器
下包: bower install 包名
简写
i-->install D-->--save - dev S-->--save
例如 bootstrap
bower install bootstrap
然后再 index.html 直接引用就可以了
啰嗦几句改端口
在 package.json 中在 --hot --port 8800
来源: https://www.cnblogs.com/fangdongdemao/p/8447697.html