vue学习

作者: iOS_Ken | 来源:发表于2020-01-03 23:37 被阅读0次

一.Vue基本概念
框架。

Vue. 是一套构建用户界面的渐进式框,
只关注视图层, 采用自底向上增量开发的设计
渐进式的含义:主张最少,没有多做职责之外的事,逐渐深入
实现响应的数据绑定和组合的视图组件

二.Vue.js 安装

1.独立版本

在官网上直接下载 vue.min.js 并用 <script> 标签引入。

2.使用 直接引入

*   **Staticfile CDN(国内)** : https://cdn.staticfile.org/vue/2.2.2/vue.min.js

*   **unpkg**:https://unpkg.com/vue/dist/vue.js, 会保持和 npm 发布的最新的版本一致。

*   **cdnjs** : https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.min.js

3.NPM 方法

a.国内没有翻墙安装npm会很慢,通过以下命令进行淘宝 NPM 镜像,或者通过梯子或者科学上网的方法进行安装

$ npm install -g cnpm --registry=https://registry.npm.taobao.org

b.进入安装

# 查看版本
$ npm -v
2.3.0

#升级 npm
cnpm install npm -g


# 升级或安装 cnpm
npm install cnpm -g

# 最新稳定版
$ cnpm install vue

# 全局安装 vue-cli
$ cnpm install --global vue-cli
# 创建一个基于 webpack 模板的新项目
$ vue init webpack my-project
# 这里需要进行一些配置,默认回车即可
This will install Vue 2.x version of the template.

For Vue 1.x use: vue init webpack#1.0 my-project

? Project name my-project
? Project description A Vue.js project
? Author runoob <test@runoob.com>
? Vue build standalone
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Setup unit tests with Karma + Mocha? Yes
? Setup e2e tests with Nightwatch? Yes

   vue-cli · Generated "my-project".

   To get started:
   
     cd my-project
     npm install
     npm run dev
   
   Documentation can be found at https://vuejs-templates.github.io/webpack

c.进入项目,安装并运行
$ cd my-project
$ cnpm install
$ cnpm run dev
 DONE  Compiled successfully in 4388ms

> Listening at http://localhost:8080

另外,可以在HBuilderX创建项目

相关文章

网友评论

      本文标题:vue学习

      本文链接:https://www.haomeiwen.com/subject/cnpioctx.html