You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
870 B
JavaScript

import { addCode, templateCombined, resetTemplate } from './template.js';
import { getInputCode } from './input.js';
import { getFormCode } from './form.js';
import { scriptCombined, resetScript } from './script.js';
import Download from '@/plugins/download';
const reset = () => {
resetScript();
resetTemplate();
};
const elementEnum = {
'hw-input': getInputCode, 'hw-form': getFormCode
};
const exportConfig = (e) => {
reset();
const noFun = () => {
};
e.map(v => {
(elementEnum[v.type] || noFun)({
isForm: false, elementData: v, formData: {}
});
});
let template = templateCombined();
let script = scriptCombined();
let codeStr = template + script;
console.log(codeStr);
const blob = new Blob([codeStr], { type: 'text/plain;charset=utf-8' });
// Download.saveAs(blob, Date.now() + '.vue');
};
export {
exportConfig
};