Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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;
}
}
initPreviewBlock() {
let _this = this;
ams.resource('previewRes', {
fields: {
id: {
type: 'text',
label: 'id'
}
// current
}
});
// 常用配置
const previewBlock = {
blocks: {
// normalTitle: null,
editTitle: {
type: 'title',
options: {
title: '编辑状态预览'
import ams from '@ams-team/ams';
import { prefix } from '@/utils';
// http://localhost:9526/examples/router/mock/list
ams.resource('resource', {
key: 'id',
api: {
// prefix: 'https://easy-mock.com/mock/5a0023effbbb09615044cb82/',
prefix: prefix,
create: 'create',
update: 'update',
read: 'read',
delete: 'delete',
list: 'list'
},
fields: {
// a: {
// type: 'text',
// label: 'a',
// show: {
// name: 'id',
import ams from '@ams-team/ams';
import { prefix } from '@/utils';
ams.resource('login', {
api: {
prefix: prefix,
create: 'login'
},
fields: {
username: {
type: 'text',
label: '用户名',
rules: [{ required: true, message: '请输入用户名', trigger: 'blur' }]
},
password: {
type: 'password',
label: '密码',
rules: [{ required: true, message: '请输入密码', trigger: 'blur' }]
}
}