getQueryString()
This commit is contained in:
@@ -427,7 +427,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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初始化
|
* socket初始化
|
||||||
*/
|
*/
|
||||||
@@ -507,19 +514,19 @@
|
|||||||
* @param {Object} b
|
* @param {Object} b
|
||||||
*/
|
*/
|
||||||
shopAdd(item, index, index1, a, b) {
|
shopAdd(item, index, index1, a, b) {
|
||||||
if ( a == "+" ){
|
if (a == "+") {
|
||||||
|
|
||||||
if ( this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
|
if (this.skuNumber < this.skuSuit && this.amountcartNumber < this.skuSuit) {
|
||||||
this.amountcartNumber = this.amountcartNumber + (this.skuSuit==0?1:this.skuSuit);
|
this.amountcartNumber = this.amountcartNumber + (this.skuSuit == 0 ? 1 : this.skuSuit);
|
||||||
}else {
|
} else {
|
||||||
this.amountcartNumber++;
|
this.amountcartNumber++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (this.amountcartNumber > 0) {
|
if (this.amountcartNumber > 0) {
|
||||||
console.log(item)
|
console.log(item)
|
||||||
if ( this.skuNumber < this.skuSuit && this.amountcartNumber <= this.skuSuit) {
|
if (this.skuNumber < this.skuSuit && this.amountcartNumber <= this.skuSuit) {
|
||||||
this.amountcartNumber = this.amountcartNumber - (this.skuSuit==0?1:this.skuSuit);
|
this.amountcartNumber = this.amountcartNumber - (this.skuSuit == 0 ? 1 : this.skuSuit);
|
||||||
} else {
|
} else {
|
||||||
this.amountcartNumber = this.amountcartNumber - 1;
|
this.amountcartNumber = this.amountcartNumber - 1;
|
||||||
}
|
}
|
||||||
@@ -723,7 +730,7 @@
|
|||||||
this.addCart(params);
|
this.addCart(params);
|
||||||
} else {
|
} else {
|
||||||
this.skuId = res.data.id;
|
this.skuId = res.data.id;
|
||||||
this.skuNumber = res.data.number||0;
|
this.skuNumber = res.data.number || 0;
|
||||||
this.skuSuit = res.data.suit;
|
this.skuSuit = res.data.suit;
|
||||||
this.showShopsku = true //打开弹框
|
this.showShopsku = true //打开弹框
|
||||||
}
|
}
|
||||||
@@ -870,11 +877,11 @@
|
|||||||
const currentElement = this.topArr[this.leftIndex];
|
const currentElement = this.topArr[this.leftIndex];
|
||||||
const diff = lastElement - currentElement;
|
const diff = lastElement - currentElement;
|
||||||
console.log(diff)
|
console.log(diff)
|
||||||
if (diff > this.scrollHeight) {
|
// if (diff > this.scrollHeight) {
|
||||||
this.leftIndex = (index < 0 ? 0 : index);
|
this.leftIndex = (index < 0 ? 0 : index);
|
||||||
} else {
|
// } else {
|
||||||
this.leftIndex = this.leftIndex
|
// this.leftIndex = this.leftIndex
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/* 左侧导航点击 */
|
/* 左侧导航点击 */
|
||||||
@@ -883,7 +890,9 @@
|
|||||||
scrollTop: this.topArr[index] - this.HeighT,
|
scrollTop: this.topArr[index] - this.HeighT,
|
||||||
duration: 0
|
duration: 0
|
||||||
});
|
});
|
||||||
this.leftIndex = index
|
setTimeout(() => {
|
||||||
|
this.leftIndex = index
|
||||||
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user