添加图标和组件

This commit is contained in:
zhengw
2026-01-29 11:46:28 +08:00
parent 8960c8ea73
commit df67413bf8
9 changed files with 66 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
<view slot="note" style="display: flex;align-items: center;column-gap: 12rpx;">
<view>{{value || ''}}</view>
<t-icon wx:if="{{value}}" name="close-circle-filled" catch:tap="onClear"></t-icon>
<text wx:else>{{placeholder || title || '选择日期'}}</text>
</view>
</t-cell>
<!-- 年月日时分 -->

View File

@@ -0,0 +1,10 @@
{
"component": true,
"usingComponents": {
"t-cell": "tdesign-miniprogram/cell/cell",
"t-checkbox": "tdesign-miniprogram/checkbox/checkbox",
"t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group",
"t-radio": "tdesign-miniprogram/radio/radio",
"t-radio-group": "tdesign-miniprogram/radio-group/radio-group"
}
}

View File

@@ -0,0 +1,26 @@
Component({
options: { multipleSlots: true },
/**
* 组件的属性列表
*/
properties: {
title: null,
mode: null,
options: null,
value: null,
},
/**
* 组件的初始数据
*/
data: {},
/**
* 组件的方法列表
*/
methods: {
onOptionsChange(e: any) {
this.triggerEvent('change', e.detail);
},
},
});

View File

@@ -0,0 +1,21 @@
<!-- 选项组件 -->
<t-cell title="{{title || ''}}">
<t-checkbox-group wx:if="{{mode == 'checkbox'}}" slot="note" bind:change="onOptionsChange"
value="{{value||[]}}">
<block wx:for="{{options}}" wx:key="index">
<t-checkbox icon="rectangle" borderless="{{true}}" block="{{false}}" value="{{item.value}}"
style="margin-right: 16rpx;">
{{item.label}}
</t-checkbox>
</block>
</t-checkbox-group>
<t-radio-group wx:elif="{{mode == 'radio'}}" slot="note" bind:change="onOptionsChange"
value="{{value}}">
<block wx:for="{{options}}" wx:key="index">
<t-radio borderless="{{true}}" block="{{false}}" value="{{item.value}}"
style="margin-right: 16rpx;">
{{item.label}}
</t-radio>
</block>
</t-radio-group>
</t-cell>

View File

@@ -3,7 +3,10 @@ Component({
/**
* 组件的属性列表
*/
properties: { label: null },
properties: {
label: null,
placeholder: null,
},
/**
* 组件的初始数据

View File

@@ -1 +1,2 @@
<t-input label="{{label}}" bind:change="onChange" bind:clear="onClear" clearable />
<t-input label="{{label||''}}" placeholder="{{placeholder || label || '' }}" bind:change="onChange"
bind:clear="onClear" clearable />