vue2的书写方式点击:vue2的书写方式
放大500倍数 界面仍然保持不变
缩小25倍数 界面仍然保持不变
定义一个插槽
<template>
<div id="imooc-container" ref="refName">
<slot></slot>
</div>
</template>
<script>
export default {
name: "container",
props: {
options: Object,
},
data() {
return {
width: 0,
height: 0,
originalWidth: 0,
originalHeight: 0,
dom: null,
};
},
methods: {
// 获取
initSize() {
return new Promise((resolve) => {
this.$nextTick(() => {
this.dom = this.$refs.refName;
// 获取大屏的真实尺寸
if (this.options && this.options.width && this.options.height) {
this.width = this.options.width;
this.height = this