javascript - 使用 mailto : won't fill subject field 发送电子邮件

标签 javascript vue.js

使用 Window.open mailto: 从我的应用程序发送电子邮件。它打开电子邮件软件并填写发送电子邮件的人,但我似乎无法填写主题字段。

  methods: {
    email: function(event) {
      let mail =
        "mailto:Test@gmail.com?" +
        "&subject=" +
        escape("This is my subject");
      window.location.href = mail;
    }
  }

最佳答案

如果它是唯一的参数,则不应包含 &

methods: {
  email: function(event) {
    let mail =
      "mailto:Test@gmail.com?" +
      "subject=" +
      encodeURIComponent("This is my subject");
    window.location.href = mail;
  }
}

关于javascript - 使用 mailto : won't fill subject field 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57830270/

相关文章:

javascript - 无法删除 MarkerWithLabel

javascript - 避免 vueJS 中的 props 突变

vue.js - 为什么引用不存在的静态 nuxt Assets 的图像不会触发 @error?

javascript - Vue动态列表

ruby-on-rails - Rails + webpacker + vue : "You are using the runtime-only build of Vue where the template compiler is not available."

typescript - 对象可能是 'null' 。在 ref(null) 上

javascript - jQuery UI 仅拖动元素的中心激活可拖动垃圾

Javascript 剧透困难

javascript - pdf导出完成时回调

javascript - jQuery 日期选择器在 AngularJS 中不起作用