getQueryString()

This commit is contained in:
魏啾 2024-08-03 16:09:47 +08:00
parent f2666346c8
commit 1dd800b854
1 changed files with 24 additions and 15 deletions

View File

@ -427,7 +427,14 @@
}
},
methods: {
getQueryString(url, name) { //
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
/**
* socket初始化
*/
@ -507,19 +514,19 @@
* @param {Object} b
*/
shopAdd(item, index, index1, a, b) {
if ( a == "+" ){
if ( this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (this.skuSuit==0?1:this.skuSuit);
}else {
if (a == "+") {
if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
} else {
this.amountcartNumber++;
}
} else {
if (this.amountcartNumber > 0) {
console.log(item)
if ( this.skuNumber < this.skuSuit && this.amountcartNumber <= this.skuSuit) {
this.amountcartNumber = this.amountcartNumber - (this.skuSuit==0?1:this.skuSuit);
if (this.skuNumber < this.skuSuit && this.amountcartNumber <= this.skuSuit) {
this.amountcartNumber = this.amountcartNumber - (this.skuSuit == 0 ? 1 : this.skuSuit);
} else {
this.amountcartNumber = this.amountcartNumber - 1;
}
@ -723,7 +730,7 @@
this.addCart(params);
} else {
this.skuId = res.data.id;
this.skuNumber = res.data.number||0;
this.skuNumber = res.data.number || 0;
this.skuSuit = res.data.suit;
this.showShopsku = true //
}
@ -870,11 +877,11 @@
const currentElement = this.topArr[this.leftIndex];
const diff = lastElement - currentElement;
console.log(diff)
if (diff > this.scrollHeight) {
this.leftIndex = (index < 0 ? 0 : index);
} else {
this.leftIndex = this.leftIndex
}
// if (diff > this.scrollHeight) {
this.leftIndex = (index < 0 ? 0 : index);
// } else {
// this.leftIndex = this.leftIndex
// }
}
},
/* 左侧导航点击 */
@ -883,7 +890,9 @@
scrollTop: this.topArr[index] - this.HeighT,
duration: 0
});
this.leftIndex = index
setTimeout(() => {
this.leftIndex = index
}, 500)
}
}
}