spring boot + Vue + iView前后端分离架构(Mac版) -- (一)前端工程创建

spring boot + Vue + iView前后端分离架构(Mac版) – (一)前端工程创建

小景哥哥博客

说明:本项目是小景哥哥精心整理的Vue前端项目搭建,属于纯零基础开始的搭建步骤,如有不足和错误的地方,希望大家批评指正,感谢万分!

一、创建Vue前端项目

打开idea,File–>New–>Project,选中Empty Project,然后按照图示步骤操作即可。我们的项目名称hep-admin
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

二、安装依赖,启动项目。

在项目上单击右键,选择idea的terminal进入项目hep-admin目录,安装依赖执行命令cnpm install,然后启动项目执行命令cnpm run dev,即可看到项目运行成功提示,浏览器输入http://localhost:8080,即可访问项目。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

三、hep-admin工程引入iView框架

打开hep-admin-web model工程修改package.json文件,把文件中的dependencies和devDependencies的依赖改为如下的依赖

{
  "name": "hep-admin-web",
  "version": "1.0.0",
  "description": "hep admin Vue.js project",
  "author": "jinglisen <1033885715@qq.com>",
  "private": true,
  "scripts": {
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "start": "npm run dev",
    "build": "node build/build.js"
  },
  "dependencies": {
    "axios": "^0.15.3",
    "clipboard": "^2.0.1",
    "echarts": "^3.4.0",
    "font-awesome": "^4.7.0",
    "iview": "^3.4.0",
    "iview-area": "^1.5.17",
    "js-cookie": "^2.2.0",
    "vue": "^2.5.2",
    "vue-i18n": "^7.8.0",
    "vue-router": "^3.0.1",
    "vuex": "^2.2.1"
  },
  "devDependencies": {
    "autoprefixer": "^7.1.2",
    "babel-core": "^6.22.1",
    "babel-eslint": "^8.2.1",
    "babel-helper-vue-jsx-merge-props": "^2.0.3",
    "babel-loader": "^7.1.1",
    "babel-plugin-syntax-jsx": "^6.18.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-plugin-transform-vue-jsx": "^3.5.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "chalk": "^2.0.1",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.28.0",
    "eslint": "^4.15.0",
    "eslint-config-standard": "^10.2.1",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^1.7.1",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-node": "^5.2.0",
    "eslint-plugin-promise": "^3.4.0",
    "eslint-plugin-standard": "^3.0.1",
    "eslint-plugin-vue": "^4.0.0",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^1.1.4",
    "friendly-errors-webpack-plugin": "^1.6.1",
    "html-webpack-plugin": "^2.30.1",
    "node-notifier": "^5.1.2",
    "optimize-css-assets-webpack-plugin": "^3.2.0",
    "ora": "^1.2.0",
    "portfinder": "^1.0.13",
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.0.8",
    "postcss-url": "^7.2.1",
    "rimraf": "^2.6.0",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "uglifyjs-webpack-plugin": "^1.1.1",
    "html-loader": "^0.5.1",
    "iview-loader": "^1.0.0",
    "url-loader": "^0.5.8",
    "vue-loader": "^13.3.0",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.5.2",
    "webpack": "^3.6.0",
    "webpack-bundle-analyzer": "^2.9.0",
    "webpack-dev-server": "^2.9.1",
    "webpack-merge": "^4.1.0",
    "autoprefixer-loader": "^3.2.0",
    "babel": "^6.23.0",
    "babel-plugin-transform-object-rest-spread": "^6.26.0",
    "babel-preset-es2015": "^6.9.0",
    "babel-runtime": "^6.11.6",
    "eslint-plugin-html": "^1.7.0",
    "less": "^2.7.3",
    "less-loader": "^4.0.5",
    "style-loader": "^0.19.1",
    "vue-hot-reload-api": "^2.2.4",
    "vue-html-loader": "^1.2.3"
  },
  "engines": {
    "node": ">= 6.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

重新加载依赖,运行命令cnpm install,依赖下载完毕后,打开src-->main.js增加iView的引入。

import iView from 'iView'
import 'iview/dist/styles/iview.css'
Vue.use(iView)

接着打开src-->App.vue增加iView的一个组件来验证加载成功。

<Button type="primary">Primary</Button>

然后我们执行cnpm run dev,接着我们访问http://localhost:8080,若看到如下页面则说明我们已经成功引入了iview前端框架。
在这里插入图片描述

©️2020 CSDN 皮肤主题: 技术黑板 设计师:CSDN官方博客 返回首页