Commit b0ed5aa2 authored by 余强's avatar 余强
Browse files

fix: 支持数组class

Showing with 17 additions and 11 deletions
+17 -11
......@@ -1414,16 +1414,22 @@ export const patchSlot = (block: Block, w: Widget, param: Object, name = 'defaul
* @param w 组件
* @returns number
*/
export const classHash = (value: string, w?: Widget) => {
if (!w) { // css
return murmurhash3_32s(value, 0);
export const classHash = (value: string | string[], w?: Widget) => {
let _classHash = (value) => {
if (!w) { // css
return murmurhash3_32s(value, 0);
}
// wcss
let _$meta = w.constructor._$meta
if (!_$meta.cssHash) {
_$meta.cssHash = murmurhash3_32s(_$meta.css, 0);
}
return murmurhash3_32s(value, _$meta.cssHash);
}
// wcss
let _$meta = w.constructor._$meta
if (!_$meta.cssHash) {
_$meta.cssHash = murmurhash3_32s(_$meta.css, 0);
if (Array.isArray(value)) {
return value.map((v) => _classHash(v))
}
return murmurhash3_32s(value, _$meta.cssHash);
return _classHash(value)
}
/**
* 初始化动画(由于动画文件被旧的组件系统拿走了,提供此方法,让旧的组件组件系统将动画数据注册过来)
......@@ -1587,7 +1593,7 @@ export const defineAccessors = (wCostructor: new () => Widget, properties: strin
if (value == DirtyStage.Patch) {
for (let i = 0; i < r.length; i++) {
this._$info[r1[i]] = this._$info[r[i]]; // 赋值dirty${i} = _dirty${i}
// 清空_dirty${i}
// 清空_dirty${i}
this._$info[r[i]] = 0; // _dirty${i} = 0
}
} else if (value == DirtyStage.Clear) {
......@@ -1595,7 +1601,7 @@ export const defineAccessors = (wCostructor: new () => Widget, properties: strin
this._$info[i] = 0; // dirty${i} = 0
}
} else if (value == DirtyStage.Watch) {
for (let i = 0; i < r.length; i++) {
for (let i = 0; i < r.length; i++) {
this._$info[r1[i]] = this._$info[r[i]]; // 赋值dirty${i} = _dirty${i}
}
}
......@@ -2182,7 +2188,7 @@ const patchForByList = (widget: Widget, oldNode: ForNode, source: any, createEac
let index = 0;
iterObj(source, (len) => {
// 先扩容
if(len > oldBlocks.length) {
if (len > oldBlocks.length) {
oldBlocks.length = len;
}
}, (item, name, i) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment