Skip to content

Commit a95277c

Browse files
authored
fix(avatar): 修复在H5环境下运行报错问题 (#1831)
1 parent 489ccb2 commit a95277c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/packages/__VUE/avatar/index.taro.vue

+4-2
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ export default create({
127127
for (let i = 0; i < children.length; i++) {
128128
children[i].setAttribute('data-index', i + 1);
129129
}
130-
// state.index = avatarRef?.value?.dataset?.index;
131-
state.index = avatarRef?.value?.props['data-index'];
130+
131+
if (avatarRef?.value?.props) {
132+
state.index = avatarRef?.value?.props['data-index'];
133+
}
132134
if (state.index == state.maxIndex && state.index != avatarGroup?.props?.maxCount) {
133135
state.showMax = true;
134136
}

0 commit comments

Comments
 (0)