• 关于前端平时需要用到的方法(未完成)


    一、this.$forceUpdate();强制刷新

    二,数据重置刷新赋值

     this.dataals = Object.assign({}, this.dataals)
     
     

    2、向下取整的函数
    Math.floor();
    例如:Math.floor( 23.2222222); // 23

    3、向上取整
    Math.ceil();
    例如: Math.ceil(23.333333); // 24

    4、四舍五入
    Math.round();
    例如:Math.round(23.33333); // 23

    5、四舍五入取n位小数,运算后得到的是字符串
    ().toFixed(n); // 取小数点后n位
    例如:(36.36498524).toFixed(3); // 36.365

      <div class="views" @mouseleave="mouselev" :style="{backgroundImage:'url('+styles+')'}">
     
      styles:require('../../../../../../assets/image/icon__biaozhun.png')
     
     if(this.dataitemall.subjectDomainType=='标签'){
            this.styles=require('../../../../../../assets/image/icon__biaoqian.png')
            }else if(this.dataitemall.subjectDomainType=='分析侧资产'){
            this.styles=require('../../../../../../assets/image/icon__fenxi.png')
            }else if(this.dataitemall.subjectDomainType=='交易侧资产'){
            this.styles=require('../../../../../../assets/image/icon__jiaoyi.png')
            }else if(this.dataitemall.subjectDomainType=='数据标准'){
            this.styles=require('../../../../../../assets/image/icon__biaozhun.png')
            }else if(this.dataitemall.subjectDomainType=='数据质量规则'){
            this.styles=require('../../../../../../assets/image/icon__guize.png')
            }
     
     

    /*滚动条样式*/
            .main::-webkit-scrollbar {
                 4px;    
                /*height: 4px;*/
            }
           .main::-webkit-scrollbar-thumb {
               border-radius:10px;
               -webkit-box-shadow:inset 0 0 5px #bfbfbf;
               background:#bfbfbf;
             }
       .main::-webkit-scrollbar-track {
                -webkit-box-shadow: inset 0 0 5px #FAFAFA;
                border-radius: 0;
                background: #FAFAFA;
             }
     
     
     
    //监听浏览器窗口大小改变
      mounted(){
        this.$nextTick(()=>{
          this.heights= document.documentElement.clientHeight - 400
                  window.addEventListener('resize', () => { 
                           //浏览器变化执行动作
                           this.heights= document.documentElement.clientHeight - 400
                  });
              })
    },
     
     
     
     
     
    //获取浏览器版本
     this.$nextTick(()=>{
          if(navigator.userAgent.toLowerCase().match(/chrome/([d.]+)/)[1].substring(0,navigator.userAgent.toLowerCase().match(/chrome/([d.]+)/)[1].indexOf('.'))>=89)
           {
             this.heights=0
           }else{
            this.heights=1
          }
          }) 
    ////////////////基于谷歌版本89版本以上的兼容问题过于垃圾,十分吐槽,但我却毫无办法!!!!
     
     
     
     
     
     

    Vue中解决多个组件引用了同一个对象作为数据时,当一个组件改动了数据对象时,其他对象的数据也会随着同步改动的情况

     this.dataallsCon=JSON.parse(JSON.stringify(this.dataalls));
     
     
     
     
  • 相关阅读:
    175. 组合两个表
    101. 对称二叉树
    292. Nim游戏
    319. 灯泡开关
    155. 最小栈
    232. 用栈实现队列
    225. 用队列实现栈
    145. 二叉树的后序遍历
    144. 二叉树的前序遍历
    【leetcode】977. Squares of a Sorted Array
  • 原文地址:https://www.cnblogs.com/hz1124/p/14468047.html
Copyright © 2020-2023  润新知