-- 增加hoverBgColor
-- 优化结构
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
appendChild,
|
||||
removeChild,
|
||||
createElement,
|
||||
querySelector,
|
||||
appendChildren,
|
||||
@@ -8,7 +7,7 @@ import {
|
||||
|
||||
export function refactorCell(cell) {
|
||||
let nodes = cell.childNodes;
|
||||
let wrapper = createElement("div", "smart-table_cell");
|
||||
let wrapper = createElement("div", "stb_cell");
|
||||
while (nodes.length) {
|
||||
appendChild(wrapper, nodes[0])
|
||||
}
|
||||
@@ -17,7 +16,7 @@ export function refactorCell(cell) {
|
||||
|
||||
export function createTabelWrapper(className, vm, type, content, hasGutter) {
|
||||
let wrapper = createElement("div", className);
|
||||
let table = createElement("table", "smart-table_" + type);
|
||||
let table = createElement("table", "stb_" + type);
|
||||
table.style.width = (vm.size.tabelWidth - 1) + "px";
|
||||
appendChildren(table, [createColgroup(vm.colgroup, vm.gutterWidth, hasGutter), content])
|
||||
appendChild(wrapper, table)
|
||||
@@ -47,18 +46,16 @@ export function throttle(delay, callback) {
|
||||
|
||||
function wrapper() {
|
||||
|
||||
let self = this;
|
||||
let elapsed = new Date().getTime() - lastExec;
|
||||
let args = arguments;
|
||||
const self = this;
|
||||
const elapsed = new Date().getTime() - lastExec;
|
||||
const args = arguments;
|
||||
|
||||
function exec() {
|
||||
lastExec = new Date().getTime();
|
||||
callback.apply(self, args)
|
||||
}
|
||||
|
||||
if (timeoutID) {
|
||||
clearTimeout(timeoutID)
|
||||
}
|
||||
timeoutID && clearTimeout(timeoutID)
|
||||
|
||||
if (elapsed > delay) {
|
||||
exec()
|
||||
@@ -71,11 +68,23 @@ export function throttle(delay, callback) {
|
||||
}
|
||||
|
||||
export function debounce(delay, callback) {
|
||||
let timeout = null;
|
||||
return function() {
|
||||
if (timeout !== null) clearTimeout(timeout);
|
||||
timeout = setTimeout(callback, delay);
|
||||
let timeoutID;
|
||||
|
||||
function wrapper() {
|
||||
|
||||
const self = this;
|
||||
const args = arguments;
|
||||
|
||||
function exec() {
|
||||
callback.apply(self, args)
|
||||
}
|
||||
|
||||
timeoutID && clearTimeout(timeoutID)
|
||||
|
||||
timeoutID = setTimeout(exec, delay)
|
||||
}
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
function createColgroup(arr, gutterWidth, hasGutter) {
|
||||
|
||||
Reference in New Issue
Block a user