代码
addFrontLine(_line_location_, _padding_, _border_) {
console.log(_padding_);
console.log(_line_location_);
if (_padding_ >= _line_location_) {
_padding_ = _line_location_
}
console.log(_padding_);
console.log(_line_location_);
const css = `
.layout-tab-container .b3-list-item > .b3-list-item__toggle {
padding-left: 4px !important;
}
.layout-tab-container ul ul:before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: ${_line_location_}px;
border-left: ${_border_}px solid var(--b3-theme-background-light);
}
.layout-tab-container ul ul {
position: relative;
padding-left: ${_padding_}px;
}
`
this.applyStyles(css);
}
执行后控制台输出的值
6
20
20
20
如果把 if 语句注释掉,就恢复正常了。 有没有大佬帮看看是什么原因? 完整代码 https://github.com/zxkmm/siyuan_doctree_compress/blob/13f1b3cda6c721001c1c33ab449e6321bc791807/src/index.ts#L118
1
finab 302 天前
你打印下变量类型,如果 if 走了,那肯定不是数值类型,说不定是俩字符串呢
|
3
zxkmm OP 见谅见谅,第一次写动态类型的语言
|