收藏
回答

请教大神,弹出提示窗中的文字如何换行?

遇到的问题:在弹出提示窗中的文字需要换行。代码如下非常简单,但是都不工作。

wx.showModal({

      title: '单词秘籍',

      content: "测试\n测试\\n测试\r\n测试<br>测试</br>",

      showCancel: false,

      confirmText: '知道啦!',

      confirmColor: '#FEC635'

    })


感谢。

回答关注问题邀请回答
收藏

5 个回答

  • 原点的原点
    原点的原点
    2019-11-14

    \n  亲测有效

    2019-11-14
    有用 2
    回复
  • 林  晓
    林 晓
    2019-11-15

    <button bindtap="pop_up_butt">弹窗按钮</button>

    <view wx:if="{{ifShow}}" class="view_ifshow_css">

     <view class="center_view_css">

       <view class="fisrt_view_css">提示</view>

       <view class="scend_view_css">

         <view class="cen_View_css" >

           <text>你好!\t这是空格啊!\n我在下一行 \n 提示内容可执行换行方法</text>

         </view>

       </view>

     </view>

     <view class="butt_view_css">

       <view class="butt1_css">取消</view>

       <view class="butt2_css">确定</view>

     </view>

    </view>



    2019-11-15
    有用
    回复 2
    • 林  晓
      林 晓
      2019-11-15
      .view_ifshow_css{
        position: absolute;
        display: flex;
        flex-direction: column;
        top: 30%;
        margin-left: 10%;
        width: 80%;
        height: 500rpx;
        border: 1rpx solid #e6e6e6;
        background-color: #e6e6e6;
        border-radius: 10rpx;
      }


      .center_view_css{
        display: flex;
        flex-direction: column;

      }
      .fisrt_view_css{
        width: 100%;
        text-align: center;
        height: 100rpx;
        padding-top: 40rpx;
      }
      .scend_view_css{
        width: 100%;
        height: 200rpx;
        background-color: #ffffff;
      }
      .cen_View_css{
      text-align: center;
        height: 100%;
       
      }
      .butt_view_css{
        width: 100%;
        display: flex;
        flex-direction: row;
        height: 100rpx;
        position: absolute;
        bottom: 0;
      }
      .butt1_css{
        width: 49%;
        background-color: #f6f6f6;
        color: red;
        text-align: center;
        line-height: 100rpx;
        border: 1rpx solid #f6f6f6;
        margin-right: 1%;
      }
      .butt2_css{
        width: 49%;
        background-color: #f6f6f6;
        color: green;
        text-align: center;
        line-height: 100rpx;
        border: 1rpx solid #f6f6f6;
        margin-left: 1%;
      }
      2019-11-15
      回复
    • 林  晓
      林 晓
      2019-11-15回复林 晓
      data: {
          ifShow:false,
        },

        pop_up_butt:function(){
          var that=this;
          console.log("弹窗页面")
          that.setData({
            ifShow: !that.data.ifShow,
          })

        },
      2019-11-15
      回复
  • Yan Lu
    Yan Lu
    2019-11-14

    明白了!感谢楼上兄弟们!

    2019-11-14
    有用
    回复
  • 睡前原谅一切
    睡前原谅一切
    2019-11-14

    自己写个吧。这个弹框只能文字超出换行

    2019-11-14
    有用
    回复
  • .
    .
    2019-11-14

    换行的得自己写弹出框,小程序的文字多了会自动换行

    2019-11-14
    有用
    回复 2
    • Yan Lu
      Yan Lu
      2019-11-14
      能否粗略说说如何实现自定义的弹出框?小白一枚,谢谢。
      2019-11-14
      回复
    • .
      .
      2019-11-14回复Yan Lu
      用定位fixed啊,一个遮盖层,一个弹窗层,然后通过在data里面设置值,在界面通过wx:if判断,true显示false隐藏
      2019-11-14
      回复
登录 后发表内容
问题标签