zz-shopify-components 0.3.1-beta.3 → 0.3.1-beta.4
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/assets/zz-components.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
align-items: center;
|
|
5
5
|
height: 36px;
|
|
6
6
|
border-radius: 32px;
|
|
7
|
-
background: #
|
|
7
|
+
background: #F5F5F6;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.zz-radio-tabs-black.zz-radio-tabs {
|
|
@@ -125,10 +125,12 @@ zz-radio-tabs-item {
|
|
|
125
125
|
}
|
|
126
126
|
.content-text ol {
|
|
127
127
|
list-style: decimal;
|
|
128
|
+
padding-left: 20px;
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
.content-text ul {
|
|
131
132
|
list-style: disc;
|
|
133
|
+
padding-left: 20px;
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
/* 标题 */
|
package/assets/zz-components.js
CHANGED
|
@@ -7,13 +7,13 @@ class ZZRadioTabsItem extends HTMLElement {
|
|
|
7
7
|
// 创建radio input
|
|
8
8
|
const groupName =
|
|
9
9
|
this.closest('zz-radio-tabs')?.getAttribute('name') || 'option';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
// 获取checked属性 - 支持checked和checked="true"两种方式
|
|
11
|
+
const checked = this.hasAttribute('checked');
|
|
12
12
|
const value = this.getAttribute('value') || '';
|
|
13
13
|
const slot = this.innerHTML;
|
|
14
14
|
this.innerHTML = `
|
|
15
15
|
<label class="zz-radio-tabs-wrapper">
|
|
16
|
-
<input type="radio" name=${groupName} value=${value}>
|
|
16
|
+
<input type="radio" name=${groupName} value=${value} ${checked ? 'checked' : ''}>
|
|
17
17
|
<div class="zz-radio-tabs-label">
|
|
18
18
|
${slot}
|
|
19
19
|
</div>
|
|
@@ -50,6 +50,30 @@
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
function requestFormData(method, url, formData, options = {}) {
|
|
54
|
+
const baseUrl = options.baseUrl || DEFAULT_BASE_URL;
|
|
55
|
+
const timeout = options.timeout || DEFAULT_TIMEOUT;
|
|
56
|
+
const fullUrl = baseUrl + url;
|
|
57
|
+
|
|
58
|
+
let fetchOptions = {
|
|
59
|
+
method: method.toUpperCase(),
|
|
60
|
+
headers: {
|
|
61
|
+
// 不设置Content-Type,让浏览器自动设置multipart/form-data
|
|
62
|
+
...(options.headers || {}),
|
|
63
|
+
},
|
|
64
|
+
...options,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// 移除可能存在的Content-Type,让浏览器自动处理FormData
|
|
68
|
+
delete fetchOptions.headers['Content-Type'];
|
|
69
|
+
|
|
70
|
+
fetchOptions.body = formData;
|
|
71
|
+
|
|
72
|
+
return timeoutFetch(fetch(fullUrl, fetchOptions), timeout).then(
|
|
73
|
+
handleResponse
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
53
77
|
function handleResponse(response) {
|
|
54
78
|
if (!response.ok) {
|
|
55
79
|
if (response.status === 401) {
|
|
@@ -69,5 +93,8 @@
|
|
|
69
93
|
post: function (url, params = {}, options = {}) {
|
|
70
94
|
return request('post', url, params, options);
|
|
71
95
|
},
|
|
96
|
+
formData: function (url, formData, options = {}) {
|
|
97
|
+
return requestFormData('post', url, formData, options);
|
|
98
|
+
},
|
|
72
99
|
};
|
|
73
100
|
})();
|
package/package.json
CHANGED
|
@@ -184,6 +184,11 @@
|
|
|
184
184
|
"label": "模块id",
|
|
185
185
|
"info": "用于定位到本模块"
|
|
186
186
|
},
|
|
187
|
+
{
|
|
188
|
+
"type": "text",
|
|
189
|
+
"id": "module_id",
|
|
190
|
+
"label": "唯一id",
|
|
191
|
+
},
|
|
187
192
|
],
|
|
188
193
|
"blocks": [
|
|
189
194
|
{
|
|
@@ -262,7 +267,7 @@
|
|
|
262
267
|
}
|
|
263
268
|
</style>
|
|
264
269
|
|
|
265
|
-
<div
|
|
270
|
+
<div id="{{ section.settings.module_id }}"
|
|
266
271
|
class="responsive-section-layout {{ section.settings.animation }}"
|
|
267
272
|
{% if section.settings.module_name != blank %}data-zz-module-name="{{ section.settings.module_name }}"{% endif %}>
|
|
268
273
|
{% content_for 'blocks' %}
|