2

两行超出省略号。。。

width: 226px;
                                line-height: 18px;
                                // vertical-align: bottom;
                                overflow : hidden;
                                text-overflow: ellipsis;
                                display: -webkit-box;
                                word-wrap: break-word;
                                word-break: break-all;
                                -webkit-line-clamp: 2;
                                -webkit-box-orient: vertical;

清除浮动

.clearfix:after{/*伪元素是行内元素 正常浏览器清除浮动方法*/
        content: "";
        display: block;
        height: 0;
        clear:both;
        visibility: hidden;
    }

:style 高度的适配

``
timeLinesStyle: {

    width: '100%',
    height: 'calc(100vh - 530px)',
    overflow: 'auto'
  },

``

flex居中布局

<div class="box">
     <section class="inner"></section>
</div>
   .box {
            display: flex;
            justify-content: center; /* 水平居中 */
            align-items: center;     /* 垂直居中 */
            width: 1000px;
            height: 600px;
            border: 1px solid red;
        }
        .inner {
            width: 300px;
            height: 200px;
            background-color: red;
        }

findIndex 寻找符合条件的位置,return 这条符合的,不符合返回-1

find()函数用来查找目标元素,找到就返回该元素,找不到返回undefined。
findIndex()函数也是查找目标元素,找到就返回元素的位置,找不到就返回-1。

self.$fetch(api.customMachine.getAllOwner, params).then(res => {
                self.allOwnerList = res.data.list || []
                let oWenId = self.allOwnerList.findIndex(item => {
                    if (item.code === objData.owner.code || String(item.code) === String(objData.owner.code)) {
                        return item
                    }
                })
                if (oWenId === -1) {
                    self.allOwnerList.unshift({
                        id: objData.owner.id,
                        label: objData.owner.displayName,
                        userId: objData.owner.code,
                        value: objData.owner.code
                    })
                }
            })

时间不满两位加0

month = month.toString().padStart(2, '0')

克隆对象

var obj2 = Object.assign({}, obj1);//克隆对象

SVG图片的位置调整

width: 1.8em;
height:1.8em;
vertical-align: -0.3em;
fill: currentColor;
overflow: hidden;

代码注释

/*
 * @Author: your name
 * @Date: 2020-04-24 13:50:14
 * @LastEditTime: 2020-04-25 16:29:33
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \demo\src\CompType.js
 */
/**
     * @description: 删除kr
     * @param data 数据
     */

vue中跳转新打开窗口

let routes = this.$router.resolve({ name: defPathName, query: query })
        window.open(routes.href, ''_blank'')

防止页面初始化的时候没有得到数据,同时保证代码的健壮性

const { owner = {} } = this.drawerData
if (this.form.owner !== owner.code) {
        // console.log(''owner'')
        res = true
        return res
      }

HappyCodingTop
526 声望847 粉丝

Talk is cheap, show the code!!