晴川云百度小程序教程:textarea 多行输入框

  • textarea 多行输入框
    • 属性说明
    • 示例
      • 代码示例

    textarea 多行输入框

    解释:自定义多行输入框,支持白色主题(默认)、 边框主题和深色模式主题,可配置字符限制、错误提示方式等

    属性说明

    属性名 类型 必填 默认值 说明

    theme

    String

    default

    多行输入框主题。default:默认白色主题,border:边框主题,dark:深色模式主题

    placeholder

    String

    请输入内容

    输入内容默认文案

    placeholderStyle

    String

    输入内容默认文案的样式

    contentLimit

    Number

    120

    输入内容长度限制

    width

    String

    auto

    输入框宽度

    autoHeight

    Boolean

    false

    输入框高度是否自适应

    promptType

    String

    toast

    输入超限提示类型。text:框下文字提示;toast:toast 提示超限;none:不提示

    tipsEdge

    Number

    20

    promptType 为 text 时,出现提示时的剩余可输入字符个数

    toastText

    String

    超出字数限制

    promptType 为 toast 时,提示文案内容

    submitText

    String

    发表

    发布按钮的文字内容

    示例

    跳转编辑工具

    在开发者工具中打开

    在 WEB IDE 中打开

    扫码体验

    代码示例

    请使用百度APP扫码

    代码示例

    • SWAN
    • JS
    • CSS
    • JSON
     
     
     
    1. <view class="wrap {{theme}}">
    2. <view class="card-panel" s-for="item,index in list">
    3. <view class="mode-title">
    4. <view class="mode-title-line-left"></view>
    5. <view class="mode-title-text">{{item.titleBar}}</view>
    6. <view class="mode-title-line-right"></view>
    7. </view>
    8. <view class="smt-card-area {{platform}}-card-area">
    9. <smt-textarea class="area-content {{item.theme}}-area-content {{item.autoHeight ? 'auto-height' : ''}}"
    10. theme="{{item.theme}}"
    11. placeholder="{{item.placeholder}}"
    12. placeholder-style="{{placeholderStyle}}"
    13. autoHeight="{{item.autoHeight}}"
    14. promptType="{{item.promptType}}"
    15. width="{{item.width}}"
    16. textarea-class="external-textarea-container"
    17. textarea-content-class="external-textarea-content"
    18. textarea-input-class="external-textarea-input"
    19. textarea-button-class="external-textarea-button"/>
    20. </view>
    21. </view>
    22. <view class="smt-card-config">
    23. <view class="item-scroll">
    24. <text class="switch-text switch-text-before">沉浸式主题</text>
    25. <switch color="{{theme ==='dark' ? '#f5f5f5' : '#ddd'}}" class="init-switch" disabled="false" bind:change="changeTheme"></switch>
    26. </view>
    27. </view>
    28. </view>

    设计指南

    必须要有输入超限提示(promptType),不可不提示

    正确

    字数超出有明确提示

    错误

    字数超出限制时,无提示

    原创文章,作者:晴川运维,如若转载,请注明出处:https://baike.qcidc.com/9581.html

    (0)
    晴川运维晴川运维
    上一篇 3天前
    下一篇 3天前

    相关推荐

    发表回复

    您的邮箱地址不会被公开。 必填项已用 * 标注