vue实现pdf文件发送到邮箱功能的示例代码

2022-07-15,,,,

需求: vue实现pdf文件发送到邮箱功能

<!-- 弹窗 -->
    <van-popup v-model="showemail" closeable class="contacttel" :close-on-click-overlay="false" @close="closeemail">
      <div class="popup-header fontsize36">
        发送至邮箱
      </div>
      <div class="popup-box fontsize36 color3">
        <div class="fieldinput mb50">
          <!-- <van-field v-model="electricalmail" name="email" ref="email" @click-input="handleclickinput" label="电子邮箱" placeholder="请输入您的电子邮箱"/> -->
          <span class="pr20 pl20 fontsize30">电子邮箱</span>
          <input label="电子邮箱" class="infocentertext fontsize30" v-model="electricalmail" placeholder="请输入您的电子邮箱"/>
        </div>
        <van-button type="primary" color="#024ee0" class="popup-btn" @click="handlemsg">确认</van-button>
      </div>
</van-popup>

点击发送到邮箱方法:

handlemsg(){
      if(!this.electricalmail){
        this.$toast("邮箱不能为空");
        return;
      }else{
        let emailregexp=/^[a-za-z0-9_-]+@[a-za-z0-9_-]+(\.[a-za-z0-9_-]+)+$/;
        if(emailregexp.test(this.electricalmail))	{
 
          let params = {
            url:this.historyobj.taxurl,
            electricalmail:this.electricalmail
          }
          sendemail(params).then(res=>{
            if(res.code == 200){
              this.$toast("已发至邮箱,请查看");
              this.showemail = false;
            }else{
              this.$toast(res.msg);
            }
          })
        }else{
          this.$toast("邮箱格式不正确");
          return;
        }
      }
}

到此这篇关于vue实现pdf文件发送到邮箱功能的文章就介绍到这了,更多相关vue文件发送到邮箱内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

《vue实现pdf文件发送到邮箱功能的示例代码.doc》

下载本文的Word格式文档,以方便收藏与打印。