element input输入多行内容反显时自动换行

 当点击编辑按钮对原因进行编辑修改时,弹出编辑弹窗,当在el-input 组件里输入内容过多时,在页面回显时内容不能够进行换行处理,造成页面显示不美观。

 页面代码:

 <div id="print" style="background-color: #f2f6f9;padding: 0px 20px 0px 20px;width: 74%;margin: 10px auto;">
      <div style="margin-top: 80px;text-align: center;font-size: 24pt;font-family: 'SimSun', '宋体';">
        <b>xxxx通知</b>
      </div>
      <div
        style="font-size: 18pt; font-family: '仿宋'; text-align: initial; text-indent: 2em; color: #222222; letter-spacing: 2px; margin-top: 20px;">
        <div style="line-height: 30px;">本人{{ "王峰" }}由于{{ refInfo.examineReason != null ? refInfo.examineReason :
          refInfo.cancelRegistrationReason }}和张小姐决定解除婚姻关系。
        </div>
        <div style="margin: 5px 0px 80px 0px;">特此通知。</div>
      </div>
 </div>

 编辑弹窗代码:

 <el-dialog title="编辑理由" :visible.sync="dialogFormVisible" width="30%" :close-on-click-modal="false"
      :close-on-press-escape="false" :show-close="false" center>
      <el-form :model="form" :rules="rules" ref="form">
        <el-form-item label-width="120px" prop="content" label="理由">
          <el-input v-model="form.content" size="small" type="textarea" :rows="2" placeholder="请输入理由"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" size="small" @click="btn('form')">确定</el-button>
        <el-button size="small" @click="cancel">取消</el-button>
      </div>
    </el-dialog>

解决方法:设置对应标签 css 样式

 1 white-space: pre-wrap; 

 2 word-break: break-all;

 <div id="print" style="background-color: #f2f6f9;padding: 0px 20px 0px 20px;width: 74%;margin: 10px auto;">
      <div style="margin-top: 80px;text-align: center;font-size: 24pt;font-family: 'SimSun', '宋体';">
        <b>xxxx通知</b>
      </div>
      <div
        style="font-size: 18pt; font-family: '仿宋'; text-align: initial; text-indent: 2em; color: #222222; letter-spacing: 2px; margin-top: 20px;">
        <div style="line-height: 30px;word-break: break-all;">本人{{ "王峰" }}由于{{ refInfo.examineReason != null ? refInfo.examineReason :
          refInfo.cancelRegistrationReason }}和张小姐决定解除婚姻关系。
        </div>
        <div style="margin: 5px 0px 80px 0px;">特此通知。</div>
      </div>
    </div>

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值