fix: cannot read properties of undefined offsetWidth
This commit is contained in:
@@ -17,7 +17,9 @@ const HomeIndex: React.FC = () => {
|
||||
r: -8,
|
||||
h: 160,
|
||||
w: (el: any) => {
|
||||
return Math.max(320, el.parentNode.offsetWidth * 0.55)
|
||||
if (el) {
|
||||
return Math.max(320, el.parentNode.offsetWidth * 0.55)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -29,7 +31,9 @@ const HomeIndex: React.FC = () => {
|
||||
r: 15,
|
||||
h: 360,
|
||||
w: (el: any) => {
|
||||
return Math.max(220, el.parentNode.offsetWidth * 0.3)
|
||||
if (el) {
|
||||
return Math.max(220, el.parentNode.offsetWidth * 0.3)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -41,7 +45,9 @@ const HomeIndex: React.FC = () => {
|
||||
r: 6,
|
||||
h: 300,
|
||||
w: (el: any) => {
|
||||
return Math.max(330, el.parentNode.offsetWidth * 0.55)
|
||||
if (el) {
|
||||
return Math.max(330, el.parentNode.offsetWidth * 0.55)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -53,7 +59,9 @@ const HomeIndex: React.FC = () => {
|
||||
r: -5,
|
||||
h: 400,
|
||||
w: (el: any) => {
|
||||
return Math.max(305, el.parentNode.offsetWidth * 0.45)
|
||||
if (el) {
|
||||
return Math.max(305, el.parentNode.offsetWidth * 0.45)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -65,7 +73,9 @@ const HomeIndex: React.FC = () => {
|
||||
r: -20,
|
||||
h: 525,
|
||||
w: (el: any) => {
|
||||
return Math.max(160, el.parentNode.offsetWidth * 0.3)
|
||||
if (el) {
|
||||
return Math.max(160, el.parentNode.offsetWidth * 0.3)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -77,7 +87,9 @@ const HomeIndex: React.FC = () => {
|
||||
r: 10,
|
||||
h: 160,
|
||||
w: (el: any) => {
|
||||
return Math.max(320, el.parentNode.offsetWidth * 0.55)
|
||||
if (el) {
|
||||
return Math.max(320, el.parentNode.offsetWidth * 0.55)
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
|
Reference in New Issue
Block a user