update_ok(e){ console.log(e.detail);//e.detail.client e.detail.phone const { index, client, phone, address, remark } = e.detail; this.setData({ [`xiaoshouHeadList[${index}].client`]: client, [`xiaoshouHeadList[${index}].phone`]: phone, [`xiaoshouHeadList[${index}].address`]: address, [`xiaoshouHeadList[${index}].remark`]: remark, edit_show: false }); }
// 使用 some 检查是否有元素 if (this.data.selectGoodsList.some(function (item) { //判断num是数字 不能是0 不能是负 if (!isNum1(item.xiaoshou_num)) { wx.showToast({ title: "第" + row_num + "行,请输入正确的数量", icon: 'none', duration: 2000 }) return true; } //判断 数字 或者浮点 if (!isNum2(item.xiaoshou_price)) { wx.showToast({ title: "第" + row_num + "行,请输入正确的单价", icon: 'none', duration: 2000 }) return true; } data.push({ num: item.xiaoshou_num, goods_id: item.id, danjia: item.xiaoshou_price, zongjia: item.total, }); row_num++; })) { // some 返回 true 相当于if判断是true 终止 执行return return; // 终止整个函数 fun 的执行 }
let name = "Alice"; let greeting = `Hello, ${name}! Welcome to our website.`; console.log(greeting); // 输出: Hello, Alice! Welcome to our website. function getGreeting(name) { return `Hello, ${name}!`; } let userName = "Alice"; let message = `Today, ${getGreeting(userName)} How are you?`; console.log(message); // 输出: Today, Hello, Alice! How are you? 小程序 调用 方法需要加this.getGreeting 需要加个this.
// 假设queryForm.value和token.value已经定义并且包含你需要的数据 const params = { query: queryForm.value.query, pageNum: queryForm.value.pageNum, pageSize: queryForm.value.pageSize, deptId: queryForm.value.deptId, // 如果需要传递state,则取消下面的注释 state: queryForm.value.state, token: token.value }; // 使用URLSearchParams来构建查询字符串 const queryString = new URLSearchParams(params).toString(); // 现在你可以使用这个查询字符串来构建你的URL location.href = `${getServerUrl()}api/hit/down/excel?${queryString}`;
const selectGoodsList = this.data.selectGoodsList; const statistics = selectGoodsList.reduce((acc, item) => { const num = parseFloat(item.pandianNum) || 0; return { totalNum: acc.totalNum + num }; }, { totalNum: 0, totalPrice: 0 }); // 初始值 this.setData({ totalNum: statistics.totalNum });
站长微信:xiaomao0055
站长QQ:14496453