<template>
<div id="imooc-container" :ref="refName">
<slot></slot>
</div>
</template>
<script>
import {
ref, getCurrentInstance, onMounted, onUnmounted, nextTick } from "vue";
import {
dobule } from "../../utils/index";
export default {
name: "container",
props: {
options: Object,
},
// 在Vue3中,getCurrentInstance()可以用来获取当前组件实例
// context :上下文,包括 attrs 、 emit 、slots。所以获取实例方法需要getCurrentInstance
setup(ctx) {
const refName = "container";
const width = ref(0);
const height = ref(0);
const originalWidth = ref(0);
const originalHeight = ref(0);
let context, dom;
// 获取宽和高
const initSize = () => {
return new P
vue3保持屏幕缩放比例(缩放的多大都是固定不动的)
于 2023-01-26 19:57:46 首次发布