console
var Psn = {
model: "options",
template: '#psn-template',
};
var app = new Yox({
el: '#app',
template: '#template',
data: {
version: Yox.version,
component: "Psn",
options: {
name: "xxoo",
sex: "m"
}
},
methods: {
options: function () {
this.set('options', {
name: new Date().getTime(),
sex: this.get("sex") === "m" ? "f" : "m"
});
}
},
components: {
Psn: Psn
}
})
<div id="app"></div>
<script id="psn-template" type="text/plain">
<div>
{{options.name}} | {{options.sex}}
</div>
</script>
<script id="template" type="text/plain">
<div>
Yox version {{version}}
<hr>
<$component model="options" />
<button on-click="options()">options</button>
</div>
</script>