文档及数据
小于 1 分钟
仅保存HTML
//验证必须输入项
if(editor.validate()){
//获取HTML文档
let data = {'doc': editor.getHtml()}
//保存HTML文档到后端服务
axios.post(serverUrl, data).then(res=>{
console.log('res=>',res)
})
}
保存HTML&数据
//验证必须输入项
if(editor.validate()){
//获取HTML文档和结构化数据(JSON)
let data = {
'doc': editor.getHtml(),
'data': editor.getBindObject()
}
//保存HTML文档和结构化数据到后端服务
axios.post(this.serverUrl, data).then(res=>{
console.log('res=>',res)
})
}
获取打印用HTML
let data = {
//获取带样式的并且分页后的HTML
'html': editor.getHtmlWithStyle(),
}
//提交分页后的HTML到后端打印服务x-printer 或x-browser, 可以用于生成PDF或本地打印
axios.post(this.pdfServerUrl, data).then(res=>{
console.log('res=>',res)
})