zoukankan      html  css  js  c++  java
  • vue使用记录

    1、vue 基于vue-seamless-scroll无缝滚动:https://www.jianshu.com/p/a2a7d3a9cf2b
    2、定时器:setInterval(一直执行) setTimeout(只执行一次)

    setInterval(this.testOffline, 500)
    setTimeout(this.testOffline, 500)
    

    3、Class 与 Style 绑定

    <div
      class="static"
      v-bind:class="{ active: isActive, 'text-danger': hasError }"
    ></div>
    

    4、前端数据操作使用,使用介绍:https://www.npmjs.com/package/decimal.js

    decimal.js
    

    5、setTimeout出现is not a function

    // 此方式会出现is not a function
    setTimeout(function () {
       this.setData({
          index: "1"
       })
    }, 3000)
    
    // 使用that代替this
    var that = this;
    setTimeout(function () {
       that.setData({
          index: "1"
       })
    }, 3000)
    
    //例如:
          const that = this
          setTimeout(function () {
            that.$set(that.isWarn, cameraRank, false)
          }, 5000)
    
    // 在es6中 , 使用箭头函数是不存在这个问题的
    setTimeout( () => {
                console.log(this.type + ' says ' + say)
            }, 1000)
    

    https://www.cnblogs.com/fozero/p/7841488.html
    当我们使用箭头函数时,函数体内的this对象,就是定义时所在的对象,而不是使用时所在的对象。
    并不是因为箭头函数内部有绑定this的机制,实际原因是箭头函数根本没有自己的this,它的this是继承外面的,因此内部的this就是外层代码块的this。

  • 相关阅读:
    怎么在一个线程结束后回到主线程?
    iOS KVC & KVO
    iOS添加到购物车的简单动画效果
    如何在键盘出现时滚动表格,以适应输入框的显示
    iOS开发之多媒体播放
    算法的时间复杂度(一)
    SPI通信
    三级管的原理
    stm32之595(spi芯片)
    stm32之Systick(系统时钟)
  • 原文地址:https://www.cnblogs.com/InternetJava/p/15731278.html
Copyright © 2011-2022 走看看