仿infobip模板功能-可通过占位符配置模板内容

模仿infobip制作的模板功能,正文可在任意位置加参数的功能。如下图所示:在正文中通过{ {\d}}进行占位,在使用模板时,可在此位置自定制内容,并预览效果。
在这里插入图片描述
代码:

<template>
  <div class="template-body-wrapper">
    <div class="textarea-box">
      <el-form 
        :model="formData"
        :rules="bodyRules"
        ref="textForm"
      >
        <div class="edit-content">
          <div
            contenteditable="true" 
            @blur="handleBlur"
            ref="editor"
            class="iscroll edit-wrapper"
            @keyup="getCursor" 
            @click="getCursor"
            @input="getWordNum"
            id="contentEdit"
            placeholder="请输入消息"
          ></div>
        </div>
        <div class="textarea-bottom">
          <el-popover
            placement="top-start"
            width="480"
            ref="pop"
            trigger="click">
            <div>
              <emotion @handleEmotion="handleEmotion"></emotion>
            </div>
            <button type="button" class="button-no-style" slot="reference"><i class="hz-icon-weixiao"></i></button>
          </el-popover>
          <button type="text" class="d-value button-no-style" @click.prevent="addValue">{+}</button>
          <span 
            class="send-word-num" 
            :class="wordNum>=1014?'active_word_num':''"
          >{
  {wordNum}}/1024</span>
        </div>
        <el-form-item
          prop="text"
          class="hide-form-item"
        >
          <el-input v-model="formData.text" style="display: none;"></el-input>
        </el-form-item>
      </el-form>
    </div>
    <div class="tip-box">
      <div 
        class="tip-item"
        v-for="(item, index) in bodyTips" 
        :key="index"
      >{
  { item }}</div>
    </div>
    <el-form
      :model="dValue"
      :rules="dValueRules"
      ref="dValueForm"
    >
      <ul v-if="hasPlaceholder" class=
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值