vue3+ts从数据中拿到单个属性,并存为字符串和数组 1 let cart_idsAll = "";
vue逗号分割的字符串转数组2//从对象中遍历拿到指定属性
3 selectArrey.value.forEach(function (item) {
4//存为字符串
5 (cart_idsAll as any) += (item as any).goods_id + ",";
6 });
7//将字符串的最后⼀","删除,并根据","转为数组
8 (cart_idsAll as any) = cart_idsAll.substring(0,cart_idsAll.length-1).split(",");
9if (cart_idsAll != "") {
10 console.log("cart_idsAll", cart_idsAll);
11 } else {
12 ElMessage({
13 message: "没有选中任何订单!",
14 type: "warning",
15 });
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论