• 小程序笔记


    00

    居中

    //wxml
    <view class='main'>
        <view>水平垂直居中</view>
    </view>
    
    //wxss
    .main {
      display: flex;
      align-items: center;
      justify-content: center;  
      width: 100%;
      height: 100%;
    }

    文字线

    text-decoration:underline; /文字排版--下划线/
    text-decoration:line-through;/文字排版--删除线/

    this.setData 异常 处理

    this.setData({
                 widths - 4,
                height: widths - 4
    })   

    异常:Cannot read property 'setData' of undefined;at pages/test/test onLoad function;at api getSystemInfo success callback function
    TypeError: Cannot read property 'setData' of undefined

    var self = this ;
    self.setData({
                 widths - 4,
                height: widths - 4
    })

    js动态设置view样式

    <view class="view" style="{{view.Width}}px;height:{{view.Height}}px;"></view>

     高度设置为100%

    网页中设置body,html{height:100%};这样在他们的子元素中使用height:100%使的容器元素占满屏幕的高度,微信小程序中,没有dom对象,根节点是page,所以使用page{height:100%}

    page{
      height: 100%
    }
    .view{
      height: 100%
    }

    设置导航栏背景色

    wx.setNavigationBarColor({
          frontColor: '#ffffff',
          backgroundColor: '#F86125',
          animation: {
            duration: 400,
            timingFunc: 'easeIn'
          }
        })
    Math.floor() 向下取整
    Math.floor(5.55)  // 向下取整5
    Math.ceil() 向上取整
    Math.ceil(5.25)  //向上取整6
    Math.round() 四舍五入(取整)
    Math.round(0.105) //四舍五入取整0
    parseInt() 丢弃小数部分,保留整数部分
    parseInt(0.125) //丢弃小数部分 .125,保留整数部分 
    0%取余
    abs(x)返回数的绝对值
    acos(x)返回数的反余弦值
    asin(x)返回数的反正弦值
    atan(x)以介于 -PI/2 与 PI/2 弧度之间的数值来返回 x 的反正切值
    atan2(y,x)返回从 x 轴到点 (x,y) 的角度(介于 -PI/2 与 PI/2 弧度之间)
    ceil(x)对一个数进行上舍入。
    cos(x)返回数的余弦exp(x)返回 e 的指数。
    floor(x)对一个数进行下舍入。
    log(x)返回数的自然对数(底为e)
    MAX(x,y)返回 x 和 y 中的最高值
    min(x,y)返回 x 和 y 中的最低值
    pow(x,y)返回 x 的 y 次幂
    random()返回 0 ~ 1 之间的随机数
    ROUND(x)把一个数四舍五入为最接近的整数
    SIN(x)返回数的正弦
    SQRT(x)返回数的平方根
    TAN(x)返回一个角的正切
      display: flex; //
      flex-wrap: wrap;
      justify-content: space-around;

    00

       

    00

  • 相关阅读:
    Java并发编程:如何创建线程?
    Java并发编程:volatile关键字解析
    Java并发编程:深入剖析ThreadLocal
    Java并发编程:同步容器
    Java ConcurrentModificationException异常原因和解决方法
    Java并发编程:并发容器之ConcurrentHashMap
    Java并发编程:并发容器之CopyOnWriteArrayList
    Java并发编程:Callable、Future和FutureTask
    rest-framework频率组件
    rest-framework的权限组件
  • 原文地址:https://www.cnblogs.com/lanyubaicl/p/10429312.html
Copyright © 2020-2023  润新知