How to use the @ams-team/ams.utils 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 / 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 / zh-CN / .vuepress / components / try / demo-try.vue View on Github external
filterConfig(){
            const config = ams.utils.deepExtend({}, this.templates[this.templateIndex].config)
            if (this.templateIndex === 0) {
                // 管理后台场景
                if (!this.configFormOptions.search) { // 搜索
                    delete config.blocks.routerBlock.blocks.listBlock1.operations.name
                    delete config.blocks.routerBlock.blocks.listBlock1.operations.list
                }
                if (!this.configFormOptions.editItem) {// 编辑操作
                    delete config.blocks.routerBlock.blocks.listBlock1.operations.editItem
                }
                if (!this.configFormOptions.removeItem) {// 删除操作
                    delete config.blocks.routerBlock.blocks.listBlock1.operations.removeItem
                }
                if (!this.configFormOptions.addItem) { // 新增操作
                    delete config.blocks.routerBlock.blocks.listBlock1.operations.addItem
                }
                for(let key in config.resources.demoResource.fields) {
github vipshop / ams / packages / block-chart / src / block.vue View on Github external
deepExtend(destination, source) {
            // 数据深拷贝,与ams.utils.deepExtend不同在于数组的处理,数组直接覆盖
            const type = ams.utils.getType(source);
            if (type === 'object' || type === 'array') {
                for (let property in source) {
                    if (source.hasOwnProperty(property)) {
                        let old = destination[property];
                        let obj = source[property];
                        let oldType = ams.utils.getType(old);
                        let objType = ams.utils.getType(obj);
                        if (objType === 'object') {
                            const target = oldType === 'object' ? old : {};
                            destination[property] = this.deepExtend(target, obj);
                        } else if (objType === 'array') {
                            // const target = oldType === 'array' ? old : [];
                            destination[property] = obj;
                        } else {
                            destination[property] = source[property];
                        }
                    }
                }
            }
            return destination;
        },
        async setChartOption() {
github vipshop / ams / packages / block-ams-config / src / mixin.js View on Github external
initBlockArea() {
            let _this = this;

            // 配置项表单
            ams.block('$ams-config-edit', {
                type: 'form',
                resource: {
                    fields: ams.utils.deepExtend({}, this.config)
                },
                ctx: 'edit',
                blocks: {
                    baseTitle: {
                        type: 'title',
                        options: {
                            title: '基础设置'
                        },
                        slot: 'top'
                    },
                    fieldTitle: {
                        type: 'title',
                        options: {
                            title: '更多设置'
                        },
                        slot: 'field:rules'
github vipshop / ams / docs / zh-CN / .vuepress / components / market / template / preview.vue View on Github external
mounted() {
        let templateId = ams.utils.getQueryString('templateId');
        console.log('templateData', templateId, templateData)
        for(let i = 0; i < templateData.length; i++){
            if (templateId == templateData[i].templateId) {
                let config = (new Function(`return ${templateData[i].templateContent}`))();
                console.log(config);
                ams.block('templatePreview', config);
                this.ready = true;
                return;
            }
        }
    }
}
github vipshop / ams / docs / zh-CN / .vuepress / components / market / packages / material-card / block.vue View on Github external
parseTime(time) {
            return ams.utils.parseTime(time, 'yyyy-MM-dd HH:mm')
        },
        newCompute(time) {
github vipshop / ams / docs / doc / .vuepress / components / market / packages / template-card / block.vue View on Github external
parseTime(time) {
            return ams.utils.parseTime(time, 'yyyy-MM-dd HH:mm')
        },
        newCompute(time) {
github vipshop / ams / packages / block-chart / src / block.vue View on Github external
created() {
        const autoResizeRender = ams.configs && ams.configs['block_chart'] && ams.configs['block_chart']['resize-render'];
        if (autoResizeRender !== false) {
            const { addEvent, debounce } = ams.utils;
            addEvent(window, 'resize', debounce(() => {
                this.chartDom && this.chartDom.resize();
            }, 100));
        }
    },
    updated() {