tdesign-miniprogram
tdesign-miniprogram copied to clipboard
[t-input]使用label插槽时会导致model:value失效
tdesign-miniprogram 版本
1.0.0-rc.1
重现链接
No response
重现步骤
期望结果
No response
实际结果
No response
框架版本
No response
基础库版本
2.30.0
补充说明
input label 缺少像t-cell那样的required属性,要实现带*的效果,只有嵌套到t-cell内或使用 label='slot' 插槽,嵌套到 t-cell 会导致高度和对齐问题,使用插槽时遇到这个bug
👋 @china-live,感谢给 TDesign 提出了 issue。 请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。
编译器有警告提示:Two-way binding does not support complex data paths currently. This two-way binding is ignored.
重现代码:
<t-input placeholder="0.00" suffix="升(L)" bindchange="onQChange" model:value="{{q}}" align='right' label='slot' status="{{qError ? 'error' : 'success'}}" tips="{{qError ? '请正确输入本次的加油量' : ''}}"
t-class-tips="tips">
<view slot="label" style="display:flex;flex-direction: row;">
<block> 加油量 </block>
<block wx:if="{{true}}">
<text decode class="form-item--required"> *</text>
</block>
</view>
</t-input>
补充:纠正一下,继续测试发现,这个是由 model:value 绑定的变量名为单字母时引发的,重现代码为
data:{a:'',aa:''}
<input model:value="{{a}}" /> 失效
<input model:value="{{aa}}" /> 有效
@china-live 应该也属于小程序框架中对双向绑定表达式的限制。(虽然官方未提及)