zoukankan      html  css  js  c++  java
  • Vue ---day01

    Vue 和 React 一样都是组件化;

    核心:声明式渲染和组件系统

    其他: 客户端路由   大数据管理    build系统

    vue组件:

      根组件: let app = new Vue({})   app.$mount();延迟挂载

      可复用组件: Vue.component('component-a',{})

    options:

      el: 实例的私有属性

      template:  模板,(根实例未设置时,取el标签内容为默认模板)  (template--->vnode--->dom元素)

      render:优先级高于 el 和 template   (vnode--->dom元素,渲染速度比el和template快)

      components:私有组件

      data:对象,私有数据(可复用模板必须以函数方式返回对象)

    实例的属性和方法:

      app.$data    app.$el   app.$set 等 以$开头

      访问私有数据: app.$data.user     app.user  

    拦截监听:

      rev2.0x,Object.defineProperty (递归调用)

         添加对象属性: 

            Vue.$set()    添加属性的同时,defineProperty

            app.$set()   是Vue.$set的别名

         数组方法: shift unshift  pop push split等方法 (改写了)

         不支持空数组添加成员 

         不支持length属性

         es6操作数组方法:  [...arr, new1] 

      rev3.0x: Proxy (兼容性降低,性能增强)

    大胡子语法:

      可以在组件中渲染     {{表达式}},但不可以设置标签的属性 

    指令:

      v-text  v-html  v-pre

      v-cloak     为标签添加 v-cloak类,  [v-cloak]{display:none}  dom渲染后显示

      v-for  ...in/of...   循环遍历 

      :key   

      v-bind  标签的属性等   v-bind:class='activeClass'   也可以是数组和对象 (Vue对 v-bind 指令做了增强)  

          :class= ""    :style=""   :title=""   绑定属性

          

     

      

        

  • 相关阅读:
    PHP基础学习笔记(一)
    安装wampserver之后,浏览器中输入localhost页面显示IIS7解决办法
    HTML5常识总结(一)
    AngularJs中的服务
    AngularJs中的directives(指令part1)
    Happy Number——LeetCode
    Binary Tree Zigzag Level Order Traversal——LeetCode
    Construct Binary Tree from Preorder and Inorder Traversal——LeetCode
    Construct Binary Tree from Inorder and Postorder Traversal——LeetCode
    Convert Sorted Array to Binary Search Tree——LeetCode
  • 原文地址:https://www.cnblogs.com/baota/p/12321741.html
Copyright © 2011-2022 走看看