【发布时间】:2021-09-30 05:14:23
【问题描述】:
<template>
<div>
<Acomponent />
<Bcomponent />
<div @click="openWindow()">hellow</div>
</div>
</template>
<script>
export default {
data() {
return {}
},
methods: {
openWindow() {
const width = '1000'
const height = '600'
const left = Math.ceil((window.screen.width - width) / 2)
const top = Math.ceil((window.screen.height - height) / 2)
window.open(location.href, `width=${width}, height=${height}, left=${left}, top=${top}, resizable=yes, scrollbars=yes`)
},
},
}
</script>
希望新窗口打开后,组件A和B不会出现在新窗口中。有什么办法吗?
【问题讨论】: