Git Product home page Git Product logo

vue-cli-preset-kz's Introduction

vue-cli-preset-kz

vue项目开发预设模板

https://kuaizi-co.github.io/vue-cli-preset-kz

Install

# 首先安装vue-cli 3.0
> npm install -g @vue/cli

> vue create --preset kuaizi-co/vue-cli-preset-kz project-name --no-git

# OR more faster!!!
# - project-name
# - vue-cli-preset-kz
project-name> cd ..
> git clone https://github.com/Kuaizi-co/vue-cli-preset-kz.git
> cd vue-cli-preset-kz
> git pull origin master
> cd ..
> vue create --preset ./vue-cli-preset-kz project-name --no-git

Develop

npm run dev

Build

npm run build

Review

npm run review

功能列表

  • postcss/less/sass
  • ES6/Typescript
  • element-ui/iview
  • vue-router/vuex
  • mock server
  • style-resources-loader
  • i18n
  • axios
  • PWA
  • unit(mocha)/e2e(Nightwatch)
  • nuxt.js/egg.js

css预处理器全局变量

内置style-resources-loader,支持lesssass 加载全局变量文件。

# vue.config.js
/**
 * 样式预处理器全局变量资源插件
 * @param {String} rule webpack 规则
 */
function addStyleResource (rule) {
  rule.use('style-resource')
    .loader('style-resources-loader')
    .options({
      patterns: [
        resolve('./src/assets/less/var.less')
      ]
    })
}

*.vue文件中直接使用 var.less(scss)定义的变量,增加共同mixin只需手动添加文件的路径。

# App.vue
<style lang="less">
  h1 {
    // @color 在var.less中定义
    color: @color;
  }
</style>

preset模板

当前 preset 模板暂只有 default 默认模板,对于 tseggnuxt 模板添加时间待定。

UI 框架

本 preset 支持 element-uiiview(默认)两种。

iview

iView

element-ui

element-ui

I18n 多语言

多语言采用模块异步延迟加载方式,首先检测语言环境及用户上次使用的语言。在切换语言后,如果尚未加载的语言包将从服务器中加载,达到项目按需加载资源优化。

src
   i18n
      index.js
      zh-CN.js
      en-US.js

英文版页面

英文版页面

多页模式

通过配置vue.config.jspages参数,默认读取 src/pages下的各个目录

- src
  - pages
    - index
      - components
      - routes
      - store
      - views
      App.vue
      index.html
      main.js
    - about

每个单页基本包含3个文件

App.vue
index.html
main.js

copyright (c) www.kuaizi.ai

vue-cli-preset-kz's People

Contributors

tomieric avatar

Watchers

James Cloos avatar Yan Wen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.