How to use the @ams-team/ams.$blocks 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 / 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);
        },
github vipshop / ams / packages / block-ams-config / src / operation.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 / field.vue View on Github external
setTimeout(() => {
                                    let value = this.data.edit;
                                    this.data.view = value;
                                    this.data.value = JSON.stringify(value);
                                    ams.$blocks.list.data.list.forEach(item => { item.view = value });
                                    this.$set(ams.$blocks.list.data, 'list', _this.copy(ams.$blocks.list.data.list));
                                }, 0);
                            }
github vipshop / ams / examples / router / src / ams-config / cases-block / xlsx.js View on Github external
                downloadFile: function () { ams.$blocks.xlsxForm.exportFile() },
                uploadFile: function () { ams.$blocks.xlsxForm.importFile() }
github vipshop / ams / examples / router / src / ams-config / cases-block / xlsx.js View on Github external
                downloadTemplate: function () { ams.$blocks.xlsxForm.exportTemplate() },
                downloadFile: function () { ams.$blocks.xlsxForm.exportFile() },