zoukankan      html  css  js  c++  java
  • 微信小程序如何获取屏幕宽度

    微信小程序如何获取屏幕宽度

       方法1:

    imageLoad: function () {
       this.setData({
         imageWidth: wx.getSystemInfoSync().windowWidth
       })
     }

       方法2:

    .imgClass{
     width: 100vw;
    }

    CSS3引入的”vw”和”vh”基于宽度/高度相对于窗口大小 

    ”vw”=”view width”“vh”=”view height” 

    以上我们称为视窗单位允许我们更接近浏览器窗口来定义大小。

    .demo {
      width: 100vw;
      font-size: 10vw; /* 宽度为窗口100%, 字体大小为窗口的10% */
    }
    .demo1 {
      width: 80vw;
      font-size: 8vw; /* 宽度为窗口80%, 字体大小为窗口的8% */
    }
    .demo2 {
      width: 50vw;
      font-size: 5vw; /* 宽度为窗口50%, 字体大小为窗口的5% */
    }
    .demo3 {
      width: 10vw;
      height: 50vh; /* 宽度为窗口10%, 容器高度为窗口的50% */
    }

    转:https://blog.csdn.net/kerryqpw/article/details/78802023

     

  • 相关阅读:
    封装cookie
    敏感词过滤
    面向对象改成选项卡
    正则表达式
    cookie
    DOM
    系统对象
    cookie记录用户名
    6个原则
    23中设计模式
  • 原文地址:https://www.cnblogs.com/fps2tao/p/10119112.html
Copyright © 2011-2022 走看看