道语-i2
2025-10-08 20:21:31 -0700
道语应用开发平台
{{ toastMessage }}
${this.pageConfig.title}
${this.pageConfig.description}
`;
// 生成组件HTML
this.droppedComponents.forEach(comp => {
const style = `position: relative; margin: 10px; display: inline-block;`;
html += `\n
`;
html += this.getComponentHTML(comp);
html += `
`;
});
html += `
`;
this.generatedHTML = html;
},
// 生成完整代码
generateCode() {
this.generateHTML();
// 创建下载链接
const blob = new Blob([this.generatedHTML], { type: 'text/html; charset=utf-8' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'daolang-app.html';
a.click();
URL.revokeObjectURL(url);
this.showToast('代码已生成并下载', 'success');
},
// 显示提示
showToast(message, type = 'success') {
this.toastMessage = message;
this.toastType = type;
this.showToast = true;
setTimeout(() => {
this.showToast = false;
}, 3000);
}
}
}).mount('#app');