/template-vue

vue PC端脚手架模板

Primary LanguageJavaScriptMIT LicenseMIT

mint薄荷糖脚手架


开始

# 安装依赖包
$ npm install
$ 复制下面两行命令执行
find ./.git/hooks -type l -exec rm {} \;
find ./.githooks -type f -exec ln -sf ../../{} .git/hooks/ \;
# 本地开发
$ npm run dev:dev
# build
$ npm run build

其他暂时未用到: npm run lint npm run test:unit

关于代码规范

一般情况下在提交代码时候会检查代码规范和自动格式化代码,但是仅限于src文件夹下,对于其他文件貌似不行,故单独添加命令以满足条件

代码规范

$ npm run lint

css 代码规范

详细 参考Stylelint

关于本地开发是本地mock数据

  1. src/libs/api.js 添加接口 eg: API.TEST = CONTEXT_PATH + '/test'

  2. mock 文件夹下添加新增文件 eg: GET/api/test/index.js GET 代表请求的method 请求url是什么样子就在mock下建立什么样的文件夹 (参考列子见GET/api/test/index.js)

  3. mock数据参照 test,使用的是 mockjs

    如有疑问请联系 liubiao@itoxs.com

关于本地开发

  1. 本地mock

    $ npm run mock

这样启动命令就会让所有请求接口使用本地mockjs 进行开发,且必须事先写好mock逻辑

  1. 本地开发代理其他地址接口

    需要配置的地方

    • config/index.js

      dev: {
          headers: {
              cookie: 'cookie_user_key=xxxx' // 登陆的用户名==
          },
          remote: {
              // 测试使用,正式代理请修改, 这里修改为代理的域
              path: 'http://qzone-music.qq.com'
          }
       }
    • 启动服务 npm run remote

  2. 本地使用https (一旦本地开发使用https 将无法再热更新)

    本地也可以使用https了,使用方法见下方

    • npm run serve ---> npm run serve:https : 常规启动
    • npm run mock ---> npm run mock:https : 本地mock启动
    • npm run remote ---> npm run remote:https : 远程mock启动