Last active
February 6, 2018 13:34
-
-
Save nightire/d1e85bab28a62d2ccaaeecfff9cf8a71 to your computer and use it in GitHub Desktop.
Data Binding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
activate() { | |
document.body.classList.add('standard'); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import get from 'ember-metal/get'; | |
import set from 'ember-metal/set'; | |
export default Ember.Component.extend({ | |
actions: { | |
change() { | |
// this.toggleProperty('model'); | |
set(this, 'model', { | |
state: !get(this, 'model.state') | |
}); | |
} | |
} | |
}).reopenClass({ positionalParams: ['model'] }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import get from 'ember-metal/get'; | |
import set from 'ember-metal/set'; | |
export default Ember.Controller.extend({ | |
actions: { | |
change() { | |
this.toggleProperty('model.state'); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
model() { | |
return { | |
state: true | |
}; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*, *::before, &::after { | |
box-sizing: border-box; | |
} | |
strong { | |
color: red; | |
font-size: 1.2rem; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.10.5", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": true, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "//cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js", | |
"hack": "//cdnjs.cloudflare.com/ajax/libs/hack/0.7.7/hack.css", | |
"standard": "//cdnjs.cloudflare.com/ajax/libs/hack/0.7.7/standard.css", | |
"ember": "2.6.2", | |
"ember-data": "2.6.2", | |
"ember-template-compiler": "2.6.2", | |
"ember-testing": "2.6.2" | |
}, | |
"addons": { | |
"ember-route-action-helper": "2.0.0", | |
"ember-truth-helpers": "1.2.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如果需要一个输入框也跟着双向绑定呢 ,能给个demo 么