计算属性:
数据来源:
接收的props,
data组件自己的状态
vuex的store
全局的router
抽出的context
组件输入
数去去向:
view
派生的状态data
子组件的props
Good things are coming !
webpack特点:
对 CommonJS 、 AMD 、ES6 的语法做了兼容
对 js、css、图片等资源文件都支持打包
串联式模块加载器以及插件机制,让其具有更好的灵活性和扩展性,
例如提供对 CoffeeScript、ES6的支持
有独立的配置文件 webpack.config.js
可以将代码切割成不同的 chunk,实现按需加载,降低了初始化时间
支持 SourceUrls 和 SourceMaps,易于调试
具有强大的 Plugin 接口,大多是内部插件,使用起来比较灵活
使用异步 IO 并具有多级缓存。这使得 webpack 很快且在增量编译上更加快
webpack 的核心在于静态资源打包。gulp 的核心在于任务集成。
浏览器里常用的线程有,js线程,gui线程,http线程, 事件线程
js线程负责js解析执行
gui线程负责渲染
http负责请求通信
事件线程负责处理浏览器事件
js代码在js线程中执行时, 同步代码在js线程中直接处理
异步回调,例如事件回调,setTimeout,promise等 会被推入一个队列里
这个队列里在前面的是misco 也叫job:
process.nextTick, promise, mutationObserver
后面的是macro 也叫task:
setTimeout, setInterval, setImmediate, i/o, ui rending
promise 会被插入到下一个事件循环的前端, 注意是下一个, 不是当前的事件循环
文字跑马灯效果:http://www.wxapp-union.com/portal.php?mod=view&aid=1038
触摸水波涟漪效果:http://www.wxapp-union.com/portal.php?mod=view&aid=1350
下拉菜单效果:http://www.wxapp-union.com/portal.php?mod=view&aid=1875
五星评分效果:http://www.wxapp-union.com/portal.php?mod=view&aid=1876
数字累加,动态效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=1694
星战字幕效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=1689
动画卡片效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=2193
列表项左滑删除效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=2189
图片的滤镜效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=3949
黑客帝国metrix效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=4670
CSS3动画效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=4628
仿直播点赞气泡效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=2833
文字弹幕效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=4713
仿UC宣传页面的简单动画效果:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=4266
发短信验证码倒计时:http://www.wxapp-union.com/portal.php?mod=view&aid=1671
弹出菜单特效:http://www.wxapp-union.com/portal.php?mod=view&aid=1659
滚动动画:http://www.wxapp-union.com/portal.php?mod=view&aid=1538
实时圆形进度条:http://www.wxapp-union.com/portal.php?mod=view&aid=1456
遮罩层:http://www.wxapp-union.com/forum.php?mod=viewthread&tid=3617
仿Table效果:http://www.wxapp-union.com/portal.php?mod=view&aid=1038
操作按钮悬浮固定在底部:http://www.wxapp-union.com/portal.php?mod=view&aid=1029
支付倒计时效果:http://www.wxapp-union.com/portal.php?mod=view&aid=890
文字单行背景自适应带角标:http://www.wxapp-union.com/portal.php?mod=view&aid=636
侧边栏滑动特效;http://www.wxapp-union.com/forum.php?mod=viewthread&tid=1202
顶部导航效果:http://www.wxapp-union.com/portal.php?mod=view&aid=1665
弹出和隐藏动画:http://www.wxapp-union.com/portal.php?mod=view&aid=1449
切换动画:http://www.wxapp-union.com/portal.php?mod=view&aid=1113
CORS(Cross-origin resource sharing) “跨域资源共享”
大多数浏览器都已经支持CORS。(IE10以上)
支持CORS请求的浏览器一旦发现ajax请求跨域,会对请求做一些特殊处理,对于已经实现CORS接口的服务端,接受请求,并做出回应。
有一种情况比较特殊,如果我们发送的跨域请求为“非简单请求”,浏览器会在发出此请求之前首先发送一个请求类型为OPTIONS的“预检请求”,验证请求源是否为服务端允许源,这些对于开发这来说是感觉不到的,由浏览器代理。
总而言之,客户端不需要对跨域请求做任何特殊处理。
简单请求与非简单请求
“简单请求”满足以下特征:
(1) 请求方法是以下三种方法之一:
HEAD
GET
POST
(2)HTTP的头信息不超出以下几种字段:
Accept
Accept-Language
Content-Language
Last-Event-ID
Content-Type:application/x-www-form-urlencoded、 multipart/form-data、text/plain
constructor(props)
componentWillMount()
render()
componentDidMount()
componentWillReceiveProps(nextProps)
shouldComponentUpdate(nextProps, nextState)
componentWillUpdate(nextProps, nextState)
render( )
componentDidUpdate(prevProps, prevState )
componentWillUnmount( )
constructor
constructor(props),组件形成时调用。
constructor 函数可理解为组件的构造函数,从组件的类(class) 实例化一个组件实例。这个函数在组件形成时被调用,是所有生命周期函数中最先执行的。在constructor函数内,如有必要,进行state的初始化以及绑定方法;否则可以省去constructor函数的声明。