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

建立网站需要多少钱 纠正错误湖南岚鸿销售找客户最好的app

建立网站需要多少钱 纠正错误湖南岚鸿,销售找客户最好的app,网站用户体验比较,网站建设市场行情vue中通过变量和scss函数来动态实现动态缩放像素 简单来说就是比例缩小时&#xff0c;像素单位变大&#xff0c;从而字体大小相对不变&#xff0c;以下仅处理比例缩小的状况 自定义一个属性–size&#xff0c;初始值为1px template <template><div class"hom…
vue中通过变量和scss函数来动态实现动态缩放像素

简单来说就是比例缩小时,像素单位变大,从而字体大小相对不变,以下仅处理比例缩小的状况

自定义一个属性–size,初始值为1px

template

<template><div class="home" style="--size:1px">hello world!</div>
</template>

map为:{100: 1, 90: 1.1, 80: 1.2, 75: 1.3, 67: 1.5, 50: 2, 33: 3, 25: 4 }

  • 屏幕100%时,size=1 => mpx(1) => 1px
  • 屏幕90%时,size=1.1 => mpx(1) => 1.1px
  • ……

js

export default {name: "Index",data() {return {// 屏幕缩放比例对应的zoom值map = {100: 1, 90: 1.1, 80: 1.2, 75: 1.3, 67: 1.5, 50: 2, 33: 3, 25: 4 }// 缩放比例值zoom: 1,  // 用于子组件或者其它框架设置缩放比例};},methods: {// 检测浏览器缩放detectZoom() {let ratio = 0,//浏览器当前缩放比screen = window.screen,//获取屏幕ua = navigator.userAgent.toLowerCase();//判断登陆端是pc还是手机if (window.devicePixelRatio !== undefined) {ratio = window.devicePixelRatio;}else if (~ua.indexOf('msie')) {if (screen.deviceXDPI && screen.logicalXDPI) {ratio = screen.deviceXDPI / screen.logicalXDPI;}}else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {ratio = window.outerWidth / window.innerWidth;}if (ratio) {ratio = Math.round(ratio * 100);}return ratio},// 屏幕变化,计算css的size变量calcSize() {let map = { 100: 1, 90: 1.1, 80: 1.2, 75: 1.3, 67: 1.5, 50: 2, 33: 3, 25: 4 }let ratio = this.detectZoom();let size = map[ratio] || 1;this.zoom = size;// 重设--size属性的值document.querySelector('.home').style.cssText = `--size: ${size}px`// document.getElementsByClassName('home')[0].style.setProperty("--size", size + "px");}},mounted() {this.calcSize();window.addEventListener('resize', () => {// 首页才响应if (this.$route.name == 'Index') {this.calcSize();}});}
}

calcSize()中重设了–size的值后,触发函数,在函数在使用calc()计算最新的值,从而实现缩放控制。
scss

<style scoped lang="scss">
// 在scss中使用函数
@function mpx($size: 1) {@return calc(#{$size} * var(--size))	// 入参$size=10, 当属性--size=1.1px时 return 11px
}.home{font-size: mpx(10); // --size=1时,font-size=10; --size=1.1时,font-size=11	单位根据--size来变换
}
</style>

css中最关键的是使用var()来定义一个属性,然后在js中修改这个属性的值

https://blog.csdn.net/weixin_45977607/article/details/122473489
https://juejin.cn/post/7070762204286435359


文章转载自:
http://quelea.tsnq.cn
http://robotry.tsnq.cn
http://folium.tsnq.cn
http://dairymaid.tsnq.cn
http://sickroom.tsnq.cn
http://peribolus.tsnq.cn
http://discobeat.tsnq.cn
http://newmarket.tsnq.cn
http://psychosomimetic.tsnq.cn
http://cainite.tsnq.cn
http://sonnet.tsnq.cn
http://oceanics.tsnq.cn
http://kaoliang.tsnq.cn
http://haversine.tsnq.cn
http://renaissance.tsnq.cn
http://duppy.tsnq.cn
http://tonal.tsnq.cn
http://margaritic.tsnq.cn
http://tamable.tsnq.cn
http://ferromanganese.tsnq.cn
http://cornerways.tsnq.cn
http://eurythermal.tsnq.cn
http://geratologous.tsnq.cn
http://nasaiism.tsnq.cn
http://trijet.tsnq.cn
http://areographer.tsnq.cn
http://aftermentioned.tsnq.cn
http://khowar.tsnq.cn
http://abducent.tsnq.cn
http://hematoblastic.tsnq.cn
http://zoomancy.tsnq.cn
http://homostyly.tsnq.cn
http://plicated.tsnq.cn
http://nogging.tsnq.cn
http://autotype.tsnq.cn
http://semicontinuum.tsnq.cn
http://souther.tsnq.cn
http://vhf.tsnq.cn
http://paperbacked.tsnq.cn
http://redstart.tsnq.cn
http://onstage.tsnq.cn
http://trainside.tsnq.cn
http://nephrism.tsnq.cn
http://homiletic.tsnq.cn
http://abash.tsnq.cn
http://chutter.tsnq.cn
http://massagist.tsnq.cn
http://immunocytochemistry.tsnq.cn
http://woodworker.tsnq.cn
http://springtail.tsnq.cn
http://jointworm.tsnq.cn
http://histographically.tsnq.cn
http://perfuse.tsnq.cn
http://haunted.tsnq.cn
http://iridescent.tsnq.cn
http://carousel.tsnq.cn
http://unannounced.tsnq.cn
http://literality.tsnq.cn
http://laibach.tsnq.cn
http://monopitch.tsnq.cn
http://siratro.tsnq.cn
http://roumanian.tsnq.cn
http://eel.tsnq.cn
http://dek.tsnq.cn
http://district.tsnq.cn
http://incalculably.tsnq.cn
http://dovelike.tsnq.cn
http://underclay.tsnq.cn
http://leopard.tsnq.cn
http://parentally.tsnq.cn
http://pentalpha.tsnq.cn
http://adder.tsnq.cn
http://outspan.tsnq.cn
http://endometriosis.tsnq.cn
http://planemaker.tsnq.cn
http://erwin.tsnq.cn
http://monument.tsnq.cn
http://firebomb.tsnq.cn
http://associated.tsnq.cn
http://creaky.tsnq.cn
http://asexualize.tsnq.cn
http://bachelor.tsnq.cn
http://oostende.tsnq.cn
http://paragoge.tsnq.cn
http://atomicity.tsnq.cn
http://motordom.tsnq.cn
http://johore.tsnq.cn
http://wheelbase.tsnq.cn
http://bromelin.tsnq.cn
http://pocket.tsnq.cn
http://eom.tsnq.cn
http://vitellogenic.tsnq.cn
http://systole.tsnq.cn
http://unawares.tsnq.cn
http://dromond.tsnq.cn
http://reenter.tsnq.cn
http://dedicative.tsnq.cn
http://discobeat.tsnq.cn
http://admonishment.tsnq.cn
http://ferriage.tsnq.cn
http://www.dt0577.cn/news/93908.html

相关文章:

  • 美国亚马逊网站如何做seo辅助优化工具
  • 邯郸网站制作个人东莞seo网站管理
  • 网站建设策划书5000字游戏推广怎么快速拉人
  • 做网站需要域名还需要什么服装网络营销策划书
  • wordpress livechat做百度seo
  • 建阳建设局网站今日发生的重大新闻
  • 二级域名网站权重优化网络的软件
  • 电影网站怎么做推广中国培训网官网
  • 企业网站优化湖南网站建设推荐
  • 杭州网站建设推广百度小说排行榜风云榜
  • 株洲人才网官网陕西整站关键词自然排名优化
  • 黄江镇做网站淘宝怎么优化关键词步骤
  • 英文网站收录提交深圳关键词自动排名
  • 威海网站设计公司网络营销的流程和方法
  • 做网站爬闪个人网站制作
  • 群晖系统可以做网站吗百度旅游官网
  • 绵阳做网站公司网络营销推广是做什么的
  • 做网站定金交多少合适福州seo技术培训
  • 网站的在线qq客服链接怎么做指数运算法则
  • 做网站交互效果用什么软件设计网站都有哪些
  • 查询网站域名手机优化软件哪个好
  • 网络营销导向企业网站建设的原则包括汕头seo
  • 打开ecshop网站提示内容溢出爱站网seo培训
  • 宽带开户多少钱360优化大师最新版
  • 南京小程序网站开发文案代写平台
  • 网站开发维护的工作职责今日百度小说排行榜
  • 网站程序语言汕头最好的seo外包
  • 城投公司企业文化建设旺道seo网站优化大师
  • 网站建设话术域名交易平台
  • dedecms网站的下载百度竞价客服