Coder Social home page Coder Social logo

vue's Introduction

vue

<!-- 开发环境版本,包含了用帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

image

02.html: 模板,挂载点,实例之间的关系

03.html: 插值表达式 / v-text指令/v-html指令 / 事件指令

04.html: 属性绑定及双向数据绑定

05.html: 计算属性和侦听器

06.html: v-if,v-show,v-show

07.html: todolist

08.html: 组件拆分

09.html: 组件与实例的关系

10.html: vue-cli 简介

11.html: 数据与方法

12.html: 实例生命周期钩子

13.html: 模板语法

14.html: 计算属性和侦听器

vue's People

Contributors

geqianqian-shihan avatar

Watchers

 avatar

vue's Issues

略读源码

Object.create(null); 创建空 json

正则 replace

//function(匹配到的元素,替换后的元素,被匹配到的index,str)
 str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })

Object.keys(a) 要返回其枚举自身属性的对象

Object.values()和Object.keys()是相反的操作,把一个对象的值转换为数组

    // 一、处理对象,返回可枚举的属性数组
    let person2 = {name:"张三",age:25,address:"深圳",getName:function(){}}
    console.log(Object.keys(person2)); // ["name", "age", "address", "getName"]
        //常用技巧
        Object.keys(person2).map( (key)=>{ return person[key] } )   //["张三", 25, "深圳", ƒ]
    //二、处理数组,返回索引值
    let arr1 = ['a', 'b', 'c'];
    console.log(Object.keys(arr1));    // ["0", "1", "2"]
    //三、处理字符串,返回索引值数组
    let str1 = '123abc字符串';
    console.log(Object.keys(str1));    //["0", "1", "2", "3", "4", "5", "6", "7", "8"]

Array.every

    var aa = [{"111":"aa"},{"222":"bbbb"}];
    aa.every(function(match, index, aaArray){console.log(match);console.log(index);console.log(aaArray);})

bind实现

  /* istanbul ignore next */
  function polyfillBind (fn, ctx) {
    function boundFn (a) {
      var l = arguments.length;
      return l
        ? l > 1
          ? fn.apply(ctx, arguments)
          : fn.call(ctx, a)
        : fn.call(ctx)
    }

    boundFn._length = fn.length;
    return boundFn
  }

  function nativeBind (fn, ctx) {
    return fn.bind(ctx)
  }

  var bind = Function.prototype.bind
    ? nativeBind
    : polyfillBind;

reduce() 方法接收一个函数作为累加器,数组中的每个值(从左到右)开始缩减,最终计算为一个值。

reduce() 可以作为一个高阶函数,用于函数的 compose。
注意: reduce() 对于空数组是不会执行回调函数的。

array.reduce(function(total, currentValue, currentIndex, arr), initialValue)

绑定一次事件

  function once (fn) {
    var called = false;
    return function () {
      if (!called) {
        called = true;
        fn.apply(this, arguments);
      }
    }
  }

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.