enoyao

Results 183 comments of enoyao

```js //数据 var obj = { name: "winds", age: 18 }; function observe(obj) { //判断对象的自属性是否对象,如果时对象继续执行监听 if(!obj || typeof obj !== 'object') { return; } Object.keys(obj).forEach(function(key) { //console.log(key + '=>' +...

[参考文档](https://github.com/wclimb/MyVue) ```html Document {{name.i}} {{name}} class Vue { constructor(options = {}) { this.$el = document.querySelector(options.el); let data = this.data = options.data; Object.keys(data).forEach((key) => { this.proxyData(key); }); this.watcherTask = {}; //...

[实现 MVVM (四)- MVVM 单向绑定实现](https://www.jianshu.com/p/599c52caa7c1)

```html Document {{skill}} {{name}} let store = { list: {}, on: function (key, fn) { // 如果有则继续加队列 if (!this.list[key]) { // 没有创建新的队列 this.list[key] = []; } this.list[key].push(fn); }, emit: function...

```html Document {{name}} {{name}} {{skill}} class Vue { constructor(props) { this.$el = document.querySelector(props.el) this.$components = props.components // 把数据挂载到$data上面 let data = this.$data = props.data this.watch = new Watch() // 监听数据...

**Vue.extend** 返回的自定义构造函数可以把这些组件实例化,不过更推荐的声明式的用法是通过 **Vue.component(id, constructor)** 注册这些组件。一旦组件被注册,它们就可以在 Vue 实例的模板中以自定义元素形式使用了

1.0版本v-repeat指令已经失效了,已替换为v-for

注意写过滤器的顺序,尽可能写在全局的开头,不然会容易发生报错 ```js Vue.filter('reverse', function(value) { return value.split('').reverse().join('') }) ``` `{{title | lowercase | reverse}}`

[vue路由](http://router.vuejs.org/zh-cn/index.html) [vue ajax](http://www.doc00.com/doc/1001004eg)

vue-resource是一个非常轻量的用于处理HTTP请求的插件,它提供了两种方式来处理HTTP请求: - 使用Vue.http或this.$http - 使用Vue.resource或this.$resource 这两种方式本质上没有什么区别,阅读vue-resource的源码,你可以发现第2种方式是基于第1种方式实现的。 ```js var demo = new Vue({ el: '#app', data: { gridColumns: ['customerId', 'companyName', 'contactName', 'phone'], gridData: [], apiUrl: 'http://211.149.193.19:8080/api/customers' }, ready: function() { this.getCustomers()...