已优化
This commit is contained in:
+21
-4
@@ -1,8 +1,25 @@
|
||||
import Taro from "@tarojs/taro"
|
||||
import Qs from 'qs'
|
||||
|
||||
export const goLink = (path?:string, params?:Object) => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/search/index'
|
||||
})
|
||||
/**
|
||||
* 跳转
|
||||
* @param path
|
||||
* @param params
|
||||
* @param type false 跳转普通页面,true 跳转tabbar页面
|
||||
*/
|
||||
export const goLink = (path = '', params = {}, type:false|true = false) => {
|
||||
if(path) {
|
||||
let params_str = Qs.stringify(params)
|
||||
path = params_str?path+'?'+params_str:path
|
||||
if(!type) {
|
||||
Taro.navigateTo({
|
||||
url: path
|
||||
})
|
||||
} else {
|
||||
Taro.switchTab({
|
||||
url: path
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,17 @@
|
||||
import { Image, View } from "@tarojs/components"
|
||||
import Taro from "@tarojs/taro"
|
||||
import { goLink } from "@/common/common"
|
||||
import styles from './index.module.scss'
|
||||
|
||||
type params = {
|
||||
desStatus?: true|false
|
||||
}
|
||||
export default ({desStatus = true}: params) => {
|
||||
const goLink = () => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/details/index?id=1'
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<View className={styles.products_list}>
|
||||
{new Array(10).fill('').map(item => {
|
||||
return <View className={styles.products_item} onClick={() => goLink()}>
|
||||
return <View className={styles.products_item} onClick={() => goLink('/pages/details/index?id=1')}>
|
||||
<View className={styles.item_img}>
|
||||
<Image src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2Ftp01%2F1ZZQ214233446-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1651827249&t=b2fc2a3672dc8ced9e0f37ce7e2ff901"/>
|
||||
<View className={styles.num}>230色</View>
|
||||
|
||||
@@ -6,6 +6,7 @@ import Product from '@/components/product'
|
||||
import MoveBtn from '@/components/moveBtn'
|
||||
import ShopCart from '@/components/shopCart'
|
||||
import styles from './index.module.scss'
|
||||
import { goLink } from '@/common/common'
|
||||
import { useState } from 'react'
|
||||
import Taro from '@tarojs/taro'
|
||||
|
||||
@@ -32,12 +33,6 @@ export default () => {
|
||||
|
||||
const [showShopCart, setShowShopCart] = useState(false)
|
||||
|
||||
const goLink = () => {
|
||||
Taro.navigateTo({
|
||||
url: '/pages/search/index'
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<MoveBtn onClick={() => setShowShopCart(!showShopCart)}>
|
||||
<View className={styles.main}>
|
||||
@@ -45,7 +40,7 @@ export default () => {
|
||||
<View className={styles.search}>
|
||||
<View className={styles.search_collect}>我的收藏</View>
|
||||
<View className={styles.search_input}>
|
||||
<Search disabled={true} style={{width: '263rpx'}} clickOnSearch={() => goLink()}/>
|
||||
<Search disabled={true} style={{width: '263rpx'}} clickOnSearch={() => goLink('/pages/search/index')}/>
|
||||
</View>
|
||||
</View>
|
||||
<View className={styles.products}>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
import { View } from '@tarojs/components'
|
||||
import Search from '@/components/search'
|
||||
import { goLink } from '@/common/common';
|
||||
import classnames from "classnames";
|
||||
import styles from './index.module.scss'
|
||||
|
||||
@@ -8,7 +9,7 @@ export default () => {
|
||||
return (
|
||||
<View className={styles.main}>
|
||||
<View className={styles.search}>
|
||||
<Search style={{width: '100%'}} placeholder="请输入面料关键词" placeIcon="out" showBtn={true}/>
|
||||
<Search style={{width: '100%'}} placeholder="请输入面料关键词" placeIcon="out" showBtn={true} clickOnSearch={() => goLink('/pages/searchList/index')}/>
|
||||
</View>
|
||||
<View className={styles.hot}>
|
||||
<View className={styles.hot_header}>
|
||||
|
||||
Reference in New Issue
Block a user