feat: 接入小程序品牌组件基础层

This commit is contained in:
que01 committed 2026-09-20 11:33:58 +08:00
1 parent 8fd399f4c2
commit 1a9dc426f6
27 files changed
+158 -9

No files matched your search

@@ -0,0 +1,15 @@
Component({
options: { addGlobalClass: true },
properties: {
theme: { type: String, value: "primary" },
size: { type: String, value: "large" },
disabled: Boolean,
loading: Boolean,
block: { type: Boolean, value: true },
},
methods: {
handleTap(event) {
if (!this.data.disabled && !this.data.loading) this.triggerEvent("tap", event.detail);
},
},
});
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"t-button": "tdesign-miniprogram/button/button"
}
}
@@ -0,0 +1 @@
<t-button theme="{{theme}}" size="{{size}}" block="{{block}}" disabled="{{disabled}}" loading="{{loading}}" bind:tap="handleTap"><slot /></t-button>
@@ -0,0 +1,8 @@
:host {
display: block;
}
t-button {
--td-button-primary-bg-color: var(--brand-color-primary);
--td-button-primary-active-bg-color: var(--brand-color-primary-dark);
--td-button-radius: var(--brand-radius-control);
}
@@ -0,0 +1 @@
Component({ properties: { description: { type: String, value: "暂无内容" } } });
@@ -0,0 +1 @@
{ "component": true, "usingComponents": { "t-empty": "tdesign-miniprogram/empty/empty" } }
@@ -0,0 +1 @@
<t-empty description="{{description}}" />
@@ -0,0 +1,3 @@
t-empty {
--td-empty-description-color: var(--brand-color-muted);
}
@@ -0,0 +1,19 @@
Component({
options: { addGlobalClass: true },
properties: {
label: String,
value: { type: String, value: "" },
placeholder: String,
type: { type: String, value: "text" },
required: Boolean,
maxlength: { type: Number, value: -1 },
},
methods: {
handleChange(event) {
this.triggerEvent("change", event.detail);
},
handleBlur(event) {
this.triggerEvent("blur", event.detail);
},
},
});
@@ -0,0 +1,7 @@
{
"component": true,
"usingComponents": {
"t-input": "tdesign-miniprogram/input/input",
"t-textarea": "tdesign-miniprogram/textarea/textarea"
}
}
@@ -0,0 +1 @@
<view class="field"><view wx:if="{{label}}" class="label">{{label}}<text wx:if="{{required}}" class="required"> *</text></view><t-textarea wx:if="{{type === 'textarea'}}" value="{{value}}" placeholder="{{placeholder}}" maxlength="{{maxlength}}" bind:change="handleChange" bind:blur="handleBlur" /><t-input wx:else value="{{value}}" type="{{type}}" placeholder="{{placeholder}}" maxlength="{{maxlength}}" bind:change="handleChange" bind:blur="handleBlur" /></view>
@@ -0,0 +1,18 @@
.field {
margin-bottom: 24rpx;
}
.label {
margin-bottom: 12rpx;
color: var(--brand-color-text);
font-size: 28rpx;
font-weight: 600;
}
.required {
color: var(--brand-color-primary);
}
t-input,
t-textarea {
--td-input-bg-color: var(--brand-color-surface);
--td-input-border-color: #eadfce;
--td-input-border-radius: var(--brand-radius-control);
}
@@ -0,0 +1 @@
Component({ properties: { text: { type: String, value: "加载中…" } } });
@@ -0,0 +1 @@
{ "component": true, "usingComponents": { "t-loading": "tdesign-miniprogram/loading/loading" } }
@@ -0,0 +1 @@
<view class="loading"><t-loading size="48rpx" text="{{text}}" layout="vertical" /></view>
@@ -0,0 +1,6 @@
.loading {
padding: 96rpx 0;
display: flex;
justify-content: center;
color: var(--brand-color-muted);
}