Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mounted() {
console.log('mounted');
// 如果已经注册过则不再注册
ams.block('ams-config', {
type: 'ams-config',
options: {
type: this.type,
name: this.name
}
});
this.init = true;
}
}
mounted() {
// 如果已经注册过则不再注册
ams.resource('resource-material', materialResource);
this.type = ams.utils.getQueryString('type');
// console.log(data);
ams.block('market-detail', block);
this.init = true;
}
}
mounted() {
// 如果已经注册过则不再注册
ams.resource('resource-material', materialResource);
const data = ams.utils.deepExtend({
data: { type: this.type }
}, block);
// console.log(data);
ams.block('market-material', data);
this.init = true;
}
}
import ams from '@ams-team/ams';
import { prefix } from '@/utils';
// http://localhost:9526/examples/router/mock/list
ams.resource('table', {
key: 'id',
api: {
prefix: prefix,
list: 'table'
},
fields: {
id: {
type: 'text',
label: '序号',
on: {
change: function(...args) {
console.log('text change', args, this);
}
}
// props: {
// 'render-header': function(h, { column }) { // h即为cerateElement的简写,具体可看vue官方文档
},
[`${this.type}-view`]: {
type: 'form',
ctx: 'view',
resource: this.type,
data: getValues(fieldDefaultValue, this.type)
}
}
}
console.log(getValues(fieldDefaultValue, this.type))
// 只拿出对应的field来展示
const demoResource = {
fields: getValues(fields, this.type)
}
ams.resource(this.type, demoResource)
ams.block(`${this.type}`, demo)
this.init = true;
}
}
mounted() {
// 如果已经注册过则不再注册
ams.resource('resource-material', materialResource);
this.type = ams.utils.getQueryString('type');
// console.log(data);
ams.block('market-detail', block);
this.init = true;
}
}
defaultData = viewData.fields[viewData.current].default;
}
}
ams.resources.previewRes.fields.view = viewData;
ams.resources.previewRes.fields.view.ctx = 'view';
console.log(ams.resources.previewRes);
// ams.resource('previewRes', ams.resources.previewRes)
// 清空 ctx
ams.$blocks.form.initBlock();
this.$set(ams.$blocks.form.data, 'edit', defaultData);
this.$set(ams.$blocks.form.data, 'value', JSON.stringify(defaultData));
this.$set(ams.$blocks.form.data, 'view', defaultData);
ams.$blocks.list.initBlock();
ams.$blocks.list.data.list.forEach(item => { item.view = defaultData });
this.$set(ams.$blocks.list.data, 'list', this.copy(ams.$blocks.list.data.list));
},
}
change(code) {
console.log('change code', code);
try {
// eslint-disable-next-line no-new-func
let data = (new Function(`return ${code}`))();
ams.$blocks['$ams-config-edit'].data = data;
// console.log(data);
_this.updatePreview(data);
} catch (error) {
console.dir(error);
_this.$message.error('配置数据格式有误,请检查');
}
}
}
time = setTimeout(() => {
let data = ams.$blocks['$ams-config-edit'].data;
this.updatePreview(data);
// console.log('updateFieldDate', data);
ams.$blocks.codeForm.data.code = beautify(stringify(data), { indent_size: 2, space_in_empty_paren: true });
}, 10);
},
time = setTimeout(() => {
let data = ams.$blocks['$ams-config-edit'].data;
this.updatePreview(data);
// console.log('updateFieldDate', data);
ams.$blocks.codeForm.data.code = beautify(stringify(data), { indent_size: 2, space_in_empty_paren: true });
}, 10);
},