Giter Site home page Giter Site logo

learn-vue's Introduction

Sead Api

{
  "id": "elementId",
  "scope": {

  }
}

实例属性

属性 说明 类型
scope 存放options中的scope Object
el options中id对应的容器 Elemen

私有属性

属性 说明 类型
bindings 存放指令,key为scope中的属性名,value为{value: '', directives: []} Object

核心

实例化Sead主要做的事情

  1. 查找容器中配置了directive的元素列表。
  2. 依次去解析每个元素上的directive(parseDirective)
  3. 属性命名规则:标志名称-指令名称-指令参数-参数-...
  4. 属性值命名规则:scope名称 | 过滤器名称 | 过滤器名称
  5. 根据element上directive属性定义,解析出directive对象结构如下
属性 说明 类型
attr 原始属性 String
key 对应scope对象中的属性名称 String
filters 过滤器名称列表 Array
definition 该指令的定义,即directives中的那些函数 Function
argument 从attr中解析出来的参数(只支持一个参数) String
update 更新directive时调用typeof def === 'function' ? def : def.update Function
bind 如果directive中定义了bind方法,则在bindDirective中会调用 Function
el 存储当前element元素 Element
  1. bindDirective 作用域和directive建立联系,通过defineProperty使scope赋值时,会触发directive的update方法。

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.