fix lint no-prototype-builtins
This commit is contained in:
parent
a5c3fcea6e
commit
d748ba2c51
|
@ -98,7 +98,7 @@ export default defineComponent({
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
for (const item in this.form) {
|
for (const item in this.form) {
|
||||||
this.values[item] = this.form[item].hasOwnProperty('default') ? this.form[item].default : null;
|
this.values[item] = this.form[item].default ?? null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ export function install(plugin) {
|
||||||
function createPluginEnv(opts) {
|
function createPluginEnv(opts) {
|
||||||
const config = new Map();
|
const config = new Map();
|
||||||
for (const [k, v] of Object.entries(opts.plugin.config || {})) {
|
for (const [k, v] of Object.entries(opts.plugin.config || {})) {
|
||||||
config.set(k, jsToVal(opts.plugin.configData.hasOwnProperty(k) ? opts.plugin.configData[k] : v.default));
|
config.set(k, jsToVal(typeof opts.plugin.configData[k] !== 'undefined' ? opts.plugin.configData[k] : v.default));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -98,7 +98,7 @@ export function groupOn<T, S>(f: (x: T) => S, xs: T[]): T[][] {
|
||||||
export function groupByX<T>(collections: T[], keySelector: (x: T) => string) {
|
export function groupByX<T>(collections: T[], keySelector: (x: T) => string) {
|
||||||
return collections.reduce((obj: Record<string, T[]>, item: T) => {
|
return collections.reduce((obj: Record<string, T[]>, item: T) => {
|
||||||
const key = keySelector(item);
|
const key = keySelector(item);
|
||||||
if (!obj.hasOwnProperty(key)) {
|
if (typeof obj[key] === 'undefined') {
|
||||||
obj[key] = [];
|
obj[key] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,9 @@ export const useWidgetPropsManager = <F extends Form & Record<string, { default:
|
||||||
|
|
||||||
const mergeProps = () => {
|
const mergeProps = () => {
|
||||||
for (const prop of Object.keys(propsDef)) {
|
for (const prop of Object.keys(propsDef)) {
|
||||||
if (widgetProps.hasOwnProperty(prop)) continue;
|
if (typeof widgetProps[prop] === 'undefined') {
|
||||||
widgetProps[prop] = propsDef[prop].default;
|
widgetProps[prop] = propsDef[prop].default;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
watch(widgetProps, () => {
|
watch(widgetProps, () => {
|
||||||
|
|
Loading…
Reference in a new issue