diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-02-15 01:41:31 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-02-15 01:41:31 +0900 |
| commit | ad459f6dd3b8dacd09d30fb559cb1b4553da5f5f (patch) | |
| tree | 976d88c35513b8ef3ff46d83fa26d837ae626aeb /src/web/app/common/define-widget.ts | |
| parent | wip (diff) | |
| download | misskey-ad459f6dd3b8dacd09d30fb559cb1b4553da5f5f.tar.gz misskey-ad459f6dd3b8dacd09d30fb559cb1b4553da5f5f.tar.bz2 misskey-ad459f6dd3b8dacd09d30fb559cb1b4553da5f5f.zip | |
wip
Diffstat (limited to 'src/web/app/common/define-widget.ts')
| -rw-r--r-- | src/web/app/common/define-widget.ts | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/web/app/common/define-widget.ts b/src/web/app/common/define-widget.ts index 9aed5a8902..5102ee1abf 100644 --- a/src/web/app/common/define-widget.ts +++ b/src/web/app/common/define-widget.ts @@ -1,8 +1,8 @@ import Vue from 'vue'; -export default function(data: { +export default function<T extends object>(data: { name: string; - props: any; + props: T; }) { return Vue.extend({ props: { @@ -10,7 +10,7 @@ export default function(data: { type: String, required: true }, - place: { + wplace: { type: String, required: true }, @@ -42,8 +42,10 @@ export default function(data: { }, created() { if (this.props) { - Object.keys(this.wprops).forEach(prop => { - this.props[prop] = this.props.data.hasOwnProperty(prop) ? this.props.data[prop] : this.props[prop]; + Object.keys(this.props).forEach(prop => { + if (this.wprops.hasOwnProperty(prop)) { + this.props[prop] = this.wprops[prop]; + } }); } } |