How to use the @ams-team/ams.resource function in @ams-team/ams

To help you get started, we’ve selected a few @ams-team/ams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vipshop / ams / docs / doc / .vuepress / components / market / material / material.vue View on Github external
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;
    }
}
github vipshop / ams / examples / router / src / ams-config / resources / table.js View on Github external
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官方文档
github vipshop / ams / docs / zh-CN / .vuepress / components / demo / list.vue View on Github external
},
                [`${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;
    }
}
github vipshop / ams / docs / doc / .vuepress / components / market / detail / detail.vue View on Github external
mounted() {
        // 如果已经注册过则不再注册
        ams.resource('resource-material', materialResource);
        this.type = ams.utils.getQueryString('type');
        // console.log(data);
        ams.block('market-detail', block);

        this.init = true;
    }
}
github vipshop / ams / packages / block-ams-config / src / field.vue View on Github external
initPreviewBlock() {
            let _this = this;
            ams.resource('previewRes', {
                fields: {
                    id: {
                        type: 'text',
                        label: 'id'
                    }
                    // current
                }
            });
            // 常用配置
            const previewBlock = {
                blocks: {
                    // normalTitle: null,
                    editTitle: {
                        type: 'title',
                        options: {
                            title: '编辑状态预览'
github vipshop / ams / examples / router / src / ams-config / resources / resource.js View on Github external
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',
github vipshop / ams / examples / router / src / ams-config / resources / login.js View on Github external
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' }]
        }
    }