fix: guarantee text
This commit is contained in:
parent
687d9217d6
commit
3769b259ab
|
@ -1,8 +1,9 @@
|
|||
import {StateProperty, Trait} from '@avocado/traits';
|
||||
import {Property} from '@avocado/core';
|
||||
import {Trait} from '@avocado/traits';
|
||||
import {compose} from '@latus/core';
|
||||
|
||||
const decorate = compose(
|
||||
StateProperty('text', {
|
||||
Property('text', {
|
||||
track: true,
|
||||
}),
|
||||
);
|
||||
|
@ -23,4 +24,17 @@ export default () => class Textual extends decorate(Trait) {
|
|||
};
|
||||
}
|
||||
|
||||
async load(json) {
|
||||
await super.load(json);
|
||||
this.text = this.state.text;
|
||||
}
|
||||
|
||||
get text() {
|
||||
return super.text;
|
||||
}
|
||||
|
||||
set text(text) {
|
||||
super.text = text.toString();
|
||||
}
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user