Merge branch 'master' of ssh://github.com/bd-js/wcui

master
chenjiajian 2023-05-05 15:15:10 +08:00
commit 12dd847e1e
1 changed files with 11 additions and 3 deletions

View File

@ -192,7 +192,7 @@ class Sandbox extends Component {
contentLoaded(ev) { contentLoaded(ev) {
let elem = ev.target let elem = ev.target
let body = elem.contentDocument.body let body = elem.contentDocument.body
elem.style.height = body.clientHeight + 'px' elem.style.height = body.scrollHeight + 10 + 'px'
} }
renderTemplate() { renderTemplate() {
@ -207,9 +207,17 @@ class Sandbox extends Component {
mounted() { mounted() {
// //
this.#cache.preview.panel = this.$refs.preview let target = this.$refs.preview
this.#cache.preview.panel = target
this.renderTemplate() this.renderTemplate()
this.$refs.preview.style.display = 'block' target.style.display = 'block'
this.__observer = new ResizeObserver(_ => this.contentLoaded({ target }))
this.__observer.observe(target.contentDocument.body)
}
unmounted() {
this.__observer?.disconnect()
} }
render() { render() {