Giter VIP home page Giter VIP logo

vue-cli's Introduction

vue-cli

https://github.com/LauItachi/vue-cli

1. Env

1.1. Dev Env

> systeminfo
Microsoft Windows 10 Pro (10.0.17134)
....
> node -v
v10.13.0
  • IDE: WebStorm (Education ver)
  • MySQL: 云数据库 TencentDB - 关系型数据库 - MySQL

1.2. OverView

  • FrontEnd: Vue
    • SinglePage: Vue Router
    • Communication Client: Socket.io - Client
    • UI: ElementUI
  • BackEnd: Express
    • Communication Server: Socket.io - Server
    • DataStorage: MySQL

2. Install Vuejs

$ npm install -g @vue/cli
## Ubuntu needs sudo
..... # Installing
$ vue --version
3.0.5

ps: If you have the previous vue-cli (1.x or 2.x) package installed globally, you need to uninstall it first with npm uninstall vue-cli -g

If the version is 3.x, u can go Vue UI successfully

3. Vue UI

$ vue ui
🚀  Starting GUI...
🌠  Ready on http://localhost:8000

3.1. Usage

3.1.1. Project Management

snapshot01

3.1.2. Create Project

Find your workspace, the workspace of IDE is better. mkdir is not needed, vue ui can help u with that.

找到自己的工作目录,推荐在IDE的workspace目录下,不需要单独新建文件夹,vue ui工具会帮忙建项目文件夹

snapshot02

3.1.2.1. Detail 详情

snapshot03

3.1.2.2. PreSets 预设

snapshot04

Recommended manual configuration at the beginning, some settings are not necessary at that time.

一开始推荐手动,有一些配置在入手的时候没必要加

3.1.2.3. Functions(Plugins?) 功能
  • Babel: a JavaScript compiler
  • TypeScript: Not recommended
  • PWA: Progressive Web App, not now
  • Router: yeah we need it
  • Vuex: state management pattern + library, well not yet
  • CSS Pre-processors: yeah let's try this
  • Linter: Format Checker, recommended for Non-formator or strict-formater
  • Unit Testing: not yet
  • E2E: not yet
3.1.2.4. Configurations 配置

snapshot05

According to your choices in Plugins, configure your configurations

根据在功能中的选择,需要进行相应的配置

Css Pre-processors : Less, well this is less

And finish it.

SameTime

snapshot06

Vue-Cli is processing at whole time

3.2. Share Project on GitHub

snapshot07

3.3. Common Operation

  • Project setup: npm install
  • Compiles and hot-reloads for development: npm run serve
  • Compiles and minifies for production: npm run build
  • Run your tests: npm run test
  • Lints and fixes files: npm run lint

4. Vue-Router

单页应用的核心 https://router.vuejs.org/guide/

当前通过vue-ui创建的项目已经配置了vue-router,可以查看App.vue中的router-link标签,分别对应Home和About的页面或组件

5. WebSocket / Socket.io

Basic Chat Web App using Express.js, Vue.js & Socket.io

(用WebSocket被吐槽……推荐用Socket.io)

6. Stucture

snapshot08

6.1 src

src:.
│  App.vue
│  main.js
│  router.js
│
├─assets
│      logo.png
│
├─plugins
│      element.js
│
├─components
│      Footer.vue
│      Header.vue
│      NavMenu.vue
│
└─views
       Content.vue
       Index.vue
       Login.vue

6.2 UI

Recommend UI:

Use ElementUI to handle Layout & Container

6.3 MySQL

That's a simple demo in my code:

server/util/mysql_util.js

Export sql_util for methods(init, query).

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.