update store example

This commit is contained in:
dntzhang 2018-05-28 10:51:24 +08:00
parent 549df44934
commit 2296f73417
3 changed files with 17 additions and 5 deletions

View File

@ -1501,6 +1501,10 @@
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
}
// install() {
// this.$store.hello = this
// }
Hello.prototype.render = function render$$1() {
return Omi.h(
'div',
@ -1567,9 +1571,11 @@
var app = new App();
var store = new AppStore({ name: 'Omi' }, {
onRename: function onRename() {
app.update();
//app.update()
//or
//app.hello.update()
app.hello.update();
//or
//store.hello.update()
}
});

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,10 @@
import { render, Component } from '../../dist/omi.esm';
class Hello extends Component {
// install() {
// this.$store.hello = this
// }
render() {
return <div>{this.$store.name}</div>
}
@ -44,9 +48,11 @@ class AppStore {
const app = new App()
const store = new AppStore({ name: 'Omi' }, {
onRename: () => {
app.update()
//app.update()
//or
//app.hello.update()
app.hello.update()
//or
//store.hello.update()
}
})