Use for-of instead of forEach (#3583)
Co-authored-by: syuilo <syuilotan@yahoo.co.jp> Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
export default function<T extends object>(data: {
|
||||
export default function <T extends object>(data: {
|
||||
name: string;
|
||||
props?: () => T;
|
||||
}) {
|
||||
@ -53,11 +53,10 @@ export default function<T extends object>(data: {
|
||||
mergeProps() {
|
||||
if (data.props) {
|
||||
const defaultProps = data.props();
|
||||
Object.keys(defaultProps).forEach(prop => {
|
||||
if (!this.props.hasOwnProperty(prop)) {
|
||||
Vue.set(this.props, prop, defaultProps[prop]);
|
||||
}
|
||||
});
|
||||
for (const prop of Object.keys(defaultProps)) {
|
||||
if (this.props.hasOwnProperty(prop)) continue;
|
||||
Vue.set(this.props, prop, defaultProps[prop]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user