How to use @ams-team/ams - 10 common examples

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 / zh-CN / .vuepress / components / ams-config.vue View on Github external
mounted() {
        console.log('mounted');
        // 如果已经注册过则不再注册

        ams.block('ams-config', {
            type: 'ams-config',
            options: {
                type: this.type,
                name: this.name
            }
        });

        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 / 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
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));
        },
    }
github vipshop / ams / packages / block-ams-config / src / block.vue View on Github external
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('配置数据格式有误,请检查');
                                            }
                                        }
                                    }
github vipshop / ams / packages / block-ams-config / src / mixin.js View on Github external
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);
        },
github vipshop / ams / packages / block-ams-config / src / mixin.js View on Github external
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);
        },