Logbook 2020-03-10

Logbook 2020 March 10

1/2/3 hours

Optimization time control code, with callbacks and Reduce optimization of the code implementation.

We expect to solve, bug components when repeated calls.

4 hours

Fix: When the date hover in blue, circles back date selected color is blue, select and hover, heavy color.

css level is too high, not the color of the rear cover.

Fix: pop-up box button is not recognized as a click of a button box elements lead to the loss of frame judgment, leading to recover the pop-up box;.

Lost decision button in the pop-up box when the load event, not mounted.

5/6 hours

Always up bomb bombs box, certainly did not get to a certain value, calculate the height of the side of the equal sign is NaN.

2 hours ... because tune, how to adjust the page is not moving, because the tone difference JS!

7 hours

Re-optimizing compiler, with the switch case too low level! And replaced with native js jq code.

To (individual control) except the extra housing unit layout

8/9 hours

Limit input type the date of the written

Get the value of the event with the input format

handleInput(e) {
    const val1 = e.target.value
    const { cake } = this.settings
    const val = val1.replace('-', '') // ! 去除-后的有效数字字符
    const reg = /^[0-9]*$/
    if (reg.test(val)) {
        const vl = val.length
        if (cake === 'M') {
            if (vl > 4) {
                const [y, m] = [val.slice(0, 4), val.slice(4)]
                const nv = `${y}-${m}`
                e.target.value = nv
            }
        } else {
            if (vl > 6) {
                const [y, m, d] = [val.slice(0, 4), val.slice(4, 6), val.slice(6)]
                const nv = `${y}-${m}-${d}`
                e.target.value = nv
            } else if (vl > 4) {
                const [y, m] = [val.slice(0, 4), val.slice(4)]
                const nv = `${y}-${m}`
                e.target.value = nv
            }
        }
    }
}

To get the final assignment with blur event

// 处理input中的非法日期
input.blur(e => {
    const value = input.val()
    if (this.value !== value) {
        if (cake === 'M') {
            const reg = /^\d{4}-\d{1,2}$/
            if (reg.test(value)) {
                const [y, m] = value.split('-')
                this.value = new Date(y, m)
            } else {
                this.input.val(this.value)
            }
        } else if (cake === 'Y') {
            const reg = /^\d{4}$/
            if (reg.test(value)) {
                const [y] = value.split('-')
                this.value = new Date(y)
            } else {
                this.input.val(this.value)
            }
        } else {
            const reg = /^\d{4}-\d{1,2}-\d{1,2}$/
            if (reg.test(value)) {
                const [y, m, d] = value.split('-')
                this.value = new Date(y, m - 1, d)
            } else {
                this.input.val(this.value)
            }
        }
    }
})

Guess you like

Origin www.cnblogs.com/sirenvoid/p/12459846.html