vg-print 1.0.230 → 1.0.232

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -198,8 +198,20 @@ import {
198
198
  const tpl = createTemplate(tmplJson)
199
199
 
200
200
  // 2) 生成预览 HTML,自行渲染到容器
201
- const html = getHtml(tpl, printData)
202
- document.querySelector('#preview').innerHTML = html
201
+ const preview = async () => {
202
+ visible.value = true // 弹出框容器显示
203
+ await nextTick() // 等容器渲染出来
204
+
205
+ const tpl = createTemplate(tmplJson)
206
+ const html = getHtml(tpl, printData) // 始终为字符串
207
+
208
+ const container = document.getElementById('preview_content_custom') // 显示内容的div的id
209
+ if (!container) {
210
+ console.warn('预览容器不存在')
211
+ return
212
+ }
213
+ container.innerHTML = html
214
+ }
203
215
 
204
216
  // 3) 浏览器打印(不需要客户端)
205
217
  printBrowser(tpl, printData)