create-comate-pagebuilder 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-comate-pagebuilder",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "Create a modern, minimalist React + Vite + Tailwind CSS project",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -10,4 +10,38 @@
10
10
  <div id="root"></div>
11
11
  <script type="module" src="/src/main.jsx"></script>
12
12
  </body>
13
+ <script>
14
+ // 图片备用方案,要保留,避免模型生成的图片无法加载,不要删除
15
+ // 准备好的备用图片
16
+ const fallbackImages = {
17
+ avatar: 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=400',
18
+ product: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=600',
19
+ background: 'https://images.unsplash.com/photo-1557683316-973673baf926?w=1200',
20
+ default: 'https://images.unsplash.com/photo-1649972904349-6e44c42644a7?w=800'
21
+ };
22
+
23
+ // 全局监听所有图片加载错误
24
+ document.addEventListener('error', function(e) {
25
+ if (e.target.tagName === 'IMG') {
26
+ const img = e.target;
27
+
28
+ // 避免无限循环
29
+ if (img.dataset.fallbackUsed) return;
30
+
31
+ // 根据图片类别选择备用图
32
+ let fallbackUrl = fallbackImages.default;
33
+
34
+ if (img.alt?.includes('avatar') || img.alt?.includes('用户')) {
35
+ fallbackUrl = fallbackImages.avatar;
36
+ } else if (img.alt?.includes('product') || img.alt?.includes('商品')) {
37
+ fallbackUrl = fallbackImages.product;
38
+ } else if (img.className?.includes('background') || img.className?.includes('banner')) {
39
+ fallbackUrl = fallbackImages.background;
40
+ }
41
+
42
+ img.dataset.fallbackUsed = 'true';
43
+ img.src = fallbackUrl;
44
+ }
45
+ }, true);
46
+ </script>
13
47
  </html>
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pagebuilder-react-template",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pagebuilder-react-template",
9
- "version": "1.0.9",
9
+ "version": "1.0.11",
10
10
  "dependencies": {
11
11
  "clsx": "^2.1.0",
12
12
  "framer-motion": "^12.23.24",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pagebuilder-react-template",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",