Angular+Vue+React
    Vue性能最好,Vue最轻
=======================================================
Angular
    入门难,学习成本高
Vue
    简单
=======================================================
Vue
    官网:http://vuejs.org/
    中文:http://cn.vuejs.org/

Vue.js的发展
        1.x
        2.x             √
=================================================
Vue如何玩?
    new Vue({
        el:'元素选择器',
        data:{
            数据
        },
        methods:{
            方法
            方法中:this就是当前new出来的实例
        }
    });

事件
<button v-on:click="方法()">按钮</button>
<button @click="方法()">按钮</button>

指令:
    v-model                 指定数据
    v-for                      循环
        v-for="value in arr"
        v-for="(value,index) in arr"

v-for="(value,key,index) in json"
    v-show                      显示

====================================================
简易留言板

计算属性

{{reverseMessage}}

new Vue({
        el:'#app',
        data:{
            message:'hello'
        },
        computed:{
            reverseMessage(){
                return this.message.split('').reverse().join('');
            }
        }
    });

======================================================
class操作
    :class="{active:true/false}"

style操作
    :style="{width:width+'px'}"

图片    
    :src=""
==================================================
交互
    Vue本身不支持交互
    可以跟任何交互的库配合
        jquery
        axios         交互库
            不支持jsonp,只支持ajax

=======================================    
钩子函数     生命周期
    beforeCreate         创建实例之前
    created             创建实例完成
    beforeMount         挂载之间
    mounted             挂载完成
    beforeUpdate         更新之前
    updated             更新完毕
    beforeDestroy         销毁之前
    destroyed             销毁完毕

如何销毁:
        v.$destroy()

防止闪屏
    [v-clock]{
        display: none;
    }
    <div id="div1" v-clock></div>
================================================
事件
    事件对象
        $event
    @click
    @contextmenu
    @keydown

事件冒泡
        ev.cancelBubble = true;

@click.stop = "show()"

默认事件
        ev.preventDefualt();

@click.prevent = "show()"

事件冒泡和默认事件同时解决
        @click.stop.prevent = "show()"

键盘事件
        @keydown.ctrl/enter

自定义按键
        Vue.config.keyCodes.a = 65;
        @keydown.a = "show()"

=============================================
模板
    {{}}
    v-text
    v-html

-================================================

Vue组件
组件         Component
---------------------------------------------
    定义组件
        公共的组件
        Vue.component('组件的名字',{
            template:'模板',
            data(){
                return {
                    数据
                };
            }
        });
        私有的组件
        new Vue({
            components:{
                '组件的名字':{
                    template:'模板',
                }
            }
        });
    使用组件
        <组件的名字></组件的名字>

template一定要有一个根元素
组件写在template中可读性差
    <template id=""></template>

<script type="x-template" id=""></script>

==============================================
组件之间数据通信
    父级给子级数据
    <test :aaa="xxx"></test>
    Vue.component('test',{
        template:'',
        props:['aaa']
        或者
        props:{
            aaa:String
        }
    });

子级给父级数据
=============================================
Vuex
    http://vuex.vuejs.org/
============================================
Vue             filter         过滤器
============================================
路由        ***
    http://router.vuejs.org/

============================================
vue-cli         脚手架
    # 全局安装 vue-cli
    $ npm install --global vue-cli
    # 创建一个基于 webpack 模板的新项目
    $ vue init webpack my-project
    # 安装依赖,走你
    $ cd my-project
    $ npm install
    $ npm run dev

vue init webpack 项目名
    vue init webpack-simple 项目名         √
=========================================
引入静态样式资源需要:
    style-loader         
    css-loader
    下载:
    npm install style-loader css-loader --save-dev

配置:
        webpack.config.js
        {
            test: /\.css$/,
            loader: ['style-loader','css-loader']
        }
==================================================
axios                 2.x推荐
vue-resource         1.x推荐
    引入本地图片
        require(url);

前端学习(三十八)vue(笔记)的更多相关文章

  1. 前端学习(三十六)promise(笔记)

    一个页面:  头部.用户信息.新闻列表 jquery ajax:  1.$.ajax({    url:'',    dataType:'json', }).then(res=>{    //r ...

  2. 前端学习(三十九)移动端app(笔记)

    移动端App    开发App的三种方式    Native App         原生        底层语言        java         Android        oc      ...

  3. 前端学习(三十五)模块化es6(笔记)

    RequireJs:一.安装.下载    官网: requirejs.org    Npm:  npm i requirejs二.使用    以前的开发方式的问题:        1).js 是阻塞加 ...

  4. 前端学习(三十四)对象&模块化(笔记)

    人,工人 //类的定义    function Person(name,age){ //构造函数        //工厂模式        //1.原料        //var obj = new ...

  5. 前端学习(三十)es6的一些问题(笔记)

    赋值表达式    document.onclick = document.onmouseover = fn;    var a = b = c = d = 5;             不推荐 逗号表 ...

  6. 前端学习(二十八)es6&ajax(笔记)

    ES6    let    块级作用域    const    解构赋值    字符串拼接    扩展运算符    ------------------------------------------ ...

  7. Salesforce LWC学习(三十八) lwc下如何更新超过1万的数据

    背景: 今天项目组小伙伴问了一个问题,如果更新数据超过1万条的情况下,有什么好的方式来实现呢?我们都知道一个transaction只能做10000条DML数据操作,那客户的操作的数据就是超过10000 ...

  8. 学习笔记:CentOS7学习之十八:Linux系统启动原理及故障排除

    目录 学习笔记:CentOS7学习之十八:Linux系统启动原理及故障排除 18.1 centos6系统启动过程及相关配置文件 18.1.1 centos6系统启动过程 18.1.2 centos6启 ...

  9. bp(net core)+easyui+efcore实现仓储管理系统——入库管理之二(三十八)

    abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...

随机推荐

  1. 在vue项目中,解决如何在element表格中循环出图片列!

    效果图: 1,vue项目环境 2,引入element-ui组件 3,制作表格 此处省去制作循环表格数据那步,想看的可以找回我的博客:element中的表格处理:循环出表格数据 今天想在表格出循环出一列 ...

  2. 20 简述BASE64编码的作用和c#对其的支持?

  3. B/S大文件上传解决方案

    第一点:Java代码实现文件上传 FormFile file = manform.getFile(); String newfileName = null; String newpathname =  ...

  4. 【转】Office 2003 EXCEL多窗口打开

    转自:http://blog.csdn.net/god_is_gril/article/details/8992587 1.注册表备份开始/运行,输入regedit回车,打开注册表.在注册表界面定位到 ...

  5. vue双向数据绑定v-model

    1.双向数据绑定 <input v-model="msg" /> <template> <div id="app"> < ...

  6. Flueme学习之路(一)Flume的基础介绍

    背景 Hadoop业务的整体开发流程: ​ 从Hadoop的业务开发流程中可以看出,在大数据的业务处理流程中,对于数据的采集是十分重要的一步,也是不可避免的一步. ​ 许多公司的平台每天会产生大量的日 ...

  7. mariadb(四)连接查询,视图,事物,索引,外键

    一.连接查询 1)进入自己创建的zz数据库 2)创建学生表: create table students ( id int unsigned not null auto_increment prima ...

  8. 【转载】Spring boot学习记录(二)-配置文件解析

    前言:本系列文章非本人原创,转自:http://tengj.top/2017/04/24/springboot0/ 正文 Spring Boot使用了一个全局的配置文件application.prop ...

  9. Grafana+Prometheus系统监控之Redis

    REmote DIctionary Server(Redis) 是一个由Salvatore Sanfilippo写的key-value存储系统. Redis是一个开源的使用ANSI C语言编写.遵守B ...

  10. mysql使用localhost可以访问,使用ip地址无法访问

    本地安装的mysql服务,使用localhost可以连接,ip地址发无法连接: 解决办法: 进入mysql命令界面,输入select host,user from mysql.user; host字段 ...