Commit 9fbe700a9013de85c5c1f394dd67d98a3527b3e9
1 parent
8434aee7
fix: prod2-56/57
Showing
3 changed files
with
3 additions
and
10 deletions
components/ProductDetail.vue
... | ... | @@ -630,7 +630,7 @@ const clearSpanStyle = (htmlContent) => { |
630 | 630 | // 清理 span 的 style 属性 |
631 | 631 | const spans = doc.querySelectorAll("span"); |
632 | 632 | spans.forEach((span) => { |
633 | - span.removeAttribute("style"); // 清空 style 属性 | |
633 | + span?.removeAttribute("style"); // 清空 style 属性 | |
634 | 634 | }); |
635 | 635 | |
636 | 636 | // const imgs = doc.querySelectorAll("img"); | ... | ... |
deploy/prod2.sh
pages/products/detail/[id]/index.vue
... | ... | @@ -67,13 +67,6 @@ newData.productimageliststore = newData?.productimageliststore?.map( |
67 | 67 | url: `/api/show/image?fileKey=${item.fileKey}&psize=p512`, |
68 | 68 | }) |
69 | 69 | ); |
70 | -function removeTags(input: string): string { | |
71 | - // 使用正则表达式去除 <div>, <span>, <p> 标签 | |
72 | - // 这个正则表达式会匹配这些标签并移除它们,但保留标签内部的文本 | |
73 | - return input.replace(/<\/?(div|span|p|br)[^>]*>/g, ""); | |
74 | -} | |
75 | 70 | |
76 | 71 | info.value = { ...newData }; |
77 | -const introduction = removeTags(info.value.introduction); | |
78 | -info.value.introduction = introduction; | |
79 | 72 | </script> | ... | ... |