惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
罗磊的独立博客
T
The Blog of Author Tim Ferriss
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
Last Week in AI
Last Week in AI
美团技术团队
Google Online Security Blog
Google Online Security Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
D
Docker
G
Google Developers Blog
大猫的无限游戏
大猫的无限游戏
酷 壳 – CoolShell
酷 壳 – CoolShell
小众软件
小众软件
月光博客
月光博客
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
W
WeLiveSecurity
H
Heimdal Security Blog
Vercel News
Vercel News
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
Blog — PlanetScale
Blog — PlanetScale
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
A
About on SuperTechFans
C
Check Point Blog
S
Security Affairs
Hacker News - Newest:
Hacker News - Newest: "LLM"
AI
AI
WordPress大学
WordPress大学
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Help Net Security
Help Net Security
博客园_首页
The Last Watchdog
The Last Watchdog
S
SegmentFault 最新的问题
Hugging Face - Blog
Hugging Face - Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
I
Intezer
K
Kaspersky official blog
M
MIT News - Artificial intelligence
J
Java Code Geeks
G
GRAHAM CLULEY
P
Palo Alto Networks Blog

博客园 - 吹鱼算法

自己出的一套前端笔试题 js文件获取自身的URL路径 背景图片 设置距右边距离 手机端 一个像素线解决方案 css3 div 居中 怎么布局宽度自适应的正方形 前端Mvvm QC 设计解析 前端Mvvm QC 上传了测试版 对react的几点质疑 Display: table-cell实现img、文字垂直居中 为什么我们的web前端变的越来越复杂 扔格子游戏 -webkit-overflow-scrolling:touch iosBug on 在ios下 父对象是body的时候会 不调用 动态是执行脚本 html的转码玉反转码 获取url据对路径写法 CSS 外边距合并 页面禁制选中元素的 背景变蓝的通用写法
Vue 数组封装和组件data定义为函数一些猜测
吹鱼算法 · 2018-09-02 · via 博客园 - 吹鱼算法

 数组封装

var vm={
    list:[0,1]
}
var push=vm.list.push;//把数组原来的方法存起来
vm.list.push=function(arg){//重新定义数组的push方法
    push.call(this,arg);//调用老的push方法
    console.log('数组增加项');//执行其他相关的程序
}

   这里实际上新的push方法应该是放在__proto__里,上面这么写是方便理解

  上面我定义了一个简单的push方法,在数组初始化的时候 用新定义的方法代替了数组原有方法,从而实现对数组操作的封装

组件data定义

var component1={
     data:{
       name:'test'
    }
}
var component2={
     data:function(){
       name:'test'
    }
}

var vm1.xxx=component1.data;//引用
var vm2.xxx=component1.data();//复制

  组件的data一般是不能引用的,因为一个页面可能有好几个改类型的组件

  定义为函数,可以更方面每个组件的data初始化

  最近在使用Vue,在使用的过程中,慢慢对Vue的设计原理有了一些猜想,这个系列的文章就是阐述这些猜想,这些猜想并不是阅读源码的结果,纯粹是使用过程中的猜测,这个系列的文章会陆续更新,主要是用来和大家讨论Vue的实现。要研究Vue的实现,并不是每个人都适合直接看源码的,只是我不太适合直接看源码,我还是喜欢用了后,自己先在脑海里里YY一下,能都YY的差不多了,再去对照源码验证自己的猜想:)