Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js 要作为WA消息发送的Vue格式数组_Vue.js - Fatal编程技术网

Vue.js 要作为WA消息发送的Vue格式数组

Vue.js 要作为WA消息发送的Vue格式数组,vue.js,Vue.js,我正在我的应用程序中开发一个功能,通过Whatsapp发送消息 但我不知道如何显示它们。例如,给定此数组: purchaseOrderMessage() { var po = this.currentPurchaseOrder.purchase_order_lines.map(x => { return { name: x.item_name, quantity: x.quantity, };

我正在我的应用程序中开发一个功能,通过Whatsapp发送消息

但我不知道如何显示它们。例如,给定此数组:

 purchaseOrderMessage() {
      var po = this.currentPurchaseOrder.purchase_order_lines.map(x => {
        return {
          name: x.item_name,
          quantity: x.quantity,
        };
      });
      return po

    },
我通过以下方式发送Wa消息:

sendWa() {
      let url = 'https://wa.me/' + this.currentPurchaseOrder.supplier.phone + '?text=' + this.purchaseOrderMessage
      openURL(url)
},

我应该如何格式化数组以使其在消息中可读?

另请注意:wa.me API对文本长度有限制。以前我们曾尝试在我的工作场所以这种方式使用WhatsApp集成,但由于消息长度限制,我们不得不放弃。我在一家电子商务公司工作,有时客户可能会订购很多物品:邮件最终会被截断,实际上毫无用处。谢谢,我没有意识到这一点,但请回到您的问题:由于邮件格式为纯文本,因此,您可能需要构建自己的列表表示方式。例如,您需要手动插入换行符、添加项目符号字符等。是的,我不知道如何在模板之外执行。您基本上需要将数组转换为字符串表示形式。如果直接附加数组,则将调用
array.prototype.toString()
方法,该方法不会美化列表。你想如何美化这份名单取决于你:我没有答案。例如,您可以执行
.join('\n')
。记住使用
encodeURIComponent