const variantAction = (index: any, colorDef?: any) => {
const safeIndex = index && index > -1 ? index : 0
let colorIndex: number
if (colorDef) {
colorIndex = productDetail?.variants?.[safeIndex]?.colors.findIndex(
(color: any) => color?.name === colorDef
)
} else {
colorIndex = productDetail?.variants?.[safeIndex]?.colors.findIndex(
(color: any) => color?.name === productDetail?.variants?.[safeIndex]?.defaultColor
)
}
colorIndex = colorIndex && colorIndex > -1 ? colorIndex : 0
setCurrentVariant(safeIndex)
setImages(ImageMaker(productDetail?.variants?.[safeIndex]?.colors?.[colorIndex]))
setSelectedColor(productDetail?.variants?.[safeIndex]?.colors?.[colorIndex]?.['@id'])
setColors(productDetail?.variants?.[safeIndex]?.colors)
setColorName(productDetail?.variants?.[safeIndex]?.colors?.[colorIndex]?.name)
setSizes(productDetail?.variants?.[safeIndex]?.colors?.[colorIndex]?.sizes)
setPersonalizationTexts(null)
setError(false)
checkWishlist(safeIndex)
const s = productDetail?.variants?.[safeIndex]?.productId
const c = productDetail?.variants?.[safeIndex]?.colors?.[colorIndex]?.name
router.replace(`${pathname}?${createQueryString('c', c)}`)
router.replace(`${pathname}?${createQueryString('s', s)}`)
}
http://localhost:3000/campaign/33?xs=rw&s=gildan-18500
in above url i am able to see only router.replace(${pathname}?${createQueryString('s', s)}
) but i want to combin both route.replace statements and i want to show both in url
以上URL中的http://localhost:3000/campaign/33?xs=rw&s=gildan-18500我只能看到router.replace(${pathname}?${createQueryString(‘s’,S)})但我想合并两个路径。替换语句,我想在URL中显示这两个语句
更多回答
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
请澄清您的具体问题或提供更多详细信息,以突出您的确切需求。按照目前的写法,很难准确地说出你在问什么。
优秀答案推荐
我是一名优秀的程序员,十分优秀!