label 3.8.0

This commit is contained in:
Jerry
2021-07-04 18:34:42 +08:00
Unverified
parent 829a3dbf32
commit 026a348482
17 changed files with 98 additions and 82 deletions

View File

@@ -207,18 +207,18 @@ const btf = {
*
* @param {*} selector
* @param {*} eleType the type of create element
* @param {*} id id
* @param {*} cn class name
* @param {*} options object key: value
*/
wrap: function (selector, eleType, id = '', cn = '') {
wrap: (selector, eleType, options) => {
const creatEle = document.createElement(eleType)
if (id) creatEle.id = id
if (cn) creatEle.className = cn
for (const [key, value] of Object.entries(options)) {
creatEle.setAttribute(key, value)
}
selector.parentNode.insertBefore(creatEle, selector)
creatEle.appendChild(selector)
},
unwrap: function (el) {
unwrap: el => {
const elParentNode = el.parentNode
if (elParentNode !== document.body) {
elParentNode.parentNode.insertBefore(el, elParentNode)
@@ -226,7 +226,7 @@ const btf = {
}
},
isJqueryLoad: (fn) => {
isJqueryLoad: fn => {
if (typeof jQuery === 'undefined') {
getScript(GLOBAL_CONFIG.source.jQuery).then(fn)
} else {
@@ -234,9 +234,9 @@ const btf = {
}
},
isHidden: (ele) => ele.offsetHeight === 0 && ele.offsetWidth === 0,
isHidden: ele => ele.offsetHeight === 0 && ele.offsetWidth === 0,
getEleTop: (ele) => {
getEleTop: ele => {
let actualTop = ele.offsetTop
let current = ele.offsetParent