当前位置: 首页 > article >正文

【vue2】v-scale-screen大屏自适应组件

第一步:安装

npm install v-scale-screen 或 yarn add v-scale-screen

第二步:main.js中引入

import Vue from 'vue'
import VScaleScreen from 'v-scale-screen'
Vue.use(VScaleScreen)

第三步:页面使用

<template>
  <v-scale-screen width="1920" height="1080">
    <div></div>
  </v-scale-screen>
</template>

注意:

我在安装的时候vue报错了,原来是vue版本的问题,需要vue@2.6.14。

npm install -g @vue/cli@2.16.14

npm install vue-template-compiler@2.6.14 --save

 v-scale-screen 默认等比例屏幕缩放,当视图不满足比例,上下或左右会有留白(黑框)。如果想要铺满全屏,且对视图拉伸无感,可以配置autoScale,或者将fullScreen设置为true

<!-- 铺满全屏 -->
<v-scale-screen ref="scale-screen" width="1920" height="1080" :fullScreen="true">
   <div></div>
</v-scale-screen>

留白的颜色也可自定义,

<!-- 铺满全屏 -->
<v-scale-screen ref="scale-screen" width="1920" height="1080" :fullScreen="true" :boxStyle="boxStyle">
   <div></div>
</v-scale-screen>


http://www.kler.cn/news/310439.html

相关文章:

  • QCustomPlot笔记(一)
  • 2024年9月python二级易错题和难题大全(附详细解析)(二)
  • android 14.0 Launcher3长按拖拽时,获取当前是哪一屏,获取当前多少个应用图标
  • Hugging Face NLP课程学习记录 - 2. 使用 Hugging Face Transformers
  • Canvas简历编辑器-Monorepo+Rspack工程实践
  • 使用PaddleNLP调用大模型ChatGLM3-6b进行信息抽取
  • Oracle事物
  • 线性代数之QR分解和SVD分解
  • ShouldSniffAttr在自动化测试中具体是如何应用?
  • mysql事务的隔离级别学习
  • Selenium实现滑动滑块验证码验证!
  • 交换机最常用的网络变压器分为DIP和SM
  • 嵌入式单片机中数码管基本实现方法
  • ARM基础
  • C++ (进阶) ─── 多态
  • 力扣(LeetCode)每日一题 2848. 与车相交的点
  • 【智路】智路OS airos-edge
  • 【数学分析笔记】第3章第2节 连续函数(4)
  • STM32MP157/linux驱动学习记录(二)
  • 网络安全:建筑公司会计软件遭受暴力攻击
  • Flink官方文档
  • prometheus概念
  • 第R3周:LSTM-火灾温度预测:3. nn.LSTM() 函数详解
  • Matlab 的.m 文件批量转成py文件
  • HTML讲解(一)body部分
  • IDEA去除掉虚线,波浪线,和下划线实线的方法
  • 【微服务-注册中心】
  • 初识Maven:Java项目管理工具
  • 鸿蒙Harmony应用开发,数据驾驶舱 项目结构搭建
  • Android使用LiquidFun物理引擎实现果冻碰撞效果