Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
ff0f70bf
Commit
ff0f70bf
authored
Nov 09, 2021
by
Bill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修改品类导航滚动问题
parent
462da585
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
5 deletions
+48
-5
simple.tsx
...categoryNavigation/components/Layout/Commodity/simple.tsx
+47
-3
index.tsx
...plate/categoryNavigation/components/Layout/Tabs/index.tsx
+1
-2
No files found.
src/pages/mobileTemplate/categoryNavigation/components/Layout/Commodity/simple.tsx
View file @
ff0f70bf
import
React
from
'react'
;
import
React
,
{
useEffect
}
from
'react'
;
import
{
SimpleCommodity
,
CustomizeTag
}
from
'@lingxi-disign/ui'
;
import
cs
from
'classnames'
;
import
{
PlusOutlined
}
from
'@ant-design/icons'
;
import
styles
from
'./simple.less'
;
import
Container
from
'../Container'
;
import
{
useSelector
,
getIframe
,
getSelectedNode
}
from
'@lingxi-disign/react'
;
interface
Iprops
{
children
:
React
.
ReactElement
,
title
:
string
,
}
const
scrollNode
=
(
key
:
string
)
=>
{
const
iframe
=
getIframe
();
const
splitCode
=
key
.
split
(
"-"
);
if
(
splitCode
.
length
<
3
)
{
return
;
}
const
parentNode
=
getSelectedNode
(
`
${
splitCode
.
slice
(
0
,
2
).
join
(
"-"
)}
-0`
,
iframe
);
if
(
!
parentNode
)
{
return
;
}
const
cardBody
=
parentNode
.
querySelector
(
'.ant-card-body'
);
if
(
!
cardBody
)
{
return
;
}
const
selectedNode
=
getSelectedNode
(
`
${
key
}
-0`
,
iframe
);
if
(
!
selectedNode
)
{
return
}
const
{
x
,
y
,
width
}
=
selectedNode
.
getBoundingClientRect
();
if
(
cardBody
.
scrollWidth
>
selectedNode
.
scrollWidth
)
{
const
position
:{
left
?:
number
,
top
?:
number
}
=
{
left
:
x
-
18
,
top
:
0
};
cardBody
.
scrollBy
({...
position
,
behavior
:
'smooth'
});
}
}
const
SimpleCommodityList
:
React
.
FC
<
Iprops
>
&
{
Item
:
typeof
SimpleItem
}
=
(
props
:
Iprops
)
=>
{
// console.log(props);
const
{
children
,
title
}
=
props
;
const
cardProps
=
{
title
:
title
||
'标题'
,
...
...
@@ -34,8 +64,22 @@ const SimpleCommodityList: React.FC<Iprops> & { Item: typeof SimpleItem } = (pro
const
divProps
=
{
onClick
,
onDrag
,
onDragEnd
,
onDragEnter
,
onDragStart
,
onMouseOver
,
getOperateState
,
className
};
const
{
selectedInfo
,
hoverKey
}
=
useSelector
([
'pageConfig'
,
'shopId'
,
'selectedInfo'
,
'hoverKey'
]);
useEffect
(()
=>
{
if
(
hoverKey
!==
null
)
{
scrollNode
(
hoverKey
);
}
},
[
hoverKey
])
return
(
<
Container
card=
{
true
}
cardProps=
{
cardProps
as
any
}
listStyle=
{
listStyle
}
itemStyle=
{
itemStyle
}
{
...
divProps
}
>
<
Container
card=
{
true
}
cardProps=
{
cardProps
as
any
}
listStyle=
{
listStyle
}
itemStyle=
{
itemStyle
}
{
...
divProps
}
>
{
children
}
...
...
src/pages/mobileTemplate/categoryNavigation/components/Layout/Tabs/index.tsx
View file @
ff0f70bf
...
...
@@ -9,7 +9,6 @@ import { context } from '../../../common/context/context';
import
{
PublicApi
}
from
'@/services/api'
;
import
{
getAuth
}
from
'@/utils/auth'
;
import
{
usePageStatus
}
from
'@/hooks/usePageStatus'
;
import
{
usePrevious
}
from
'@umijs/hooks'
;
const
{
TabPane
}
=
Tabs
;
...
...
@@ -22,7 +21,7 @@ interface Iprops {
const
CustomizeTabs
:
React
.
FC
<
Iprops
>
&
{
TabItem
:
typeof
TabItem
}
=
(
props
:
Iprops
)
=>
{
const
{
children
}
=
props
;
const
auth
=
getAuth
();
const
{
pageConfig
,
shopId
,
selectedInfo
,
activeKey
:
currentActiveKey
,
dom
}
=
useSelector
([
'pageConfig'
,
'shopId'
,
'selectedInfo'
,
'domKey'
,
'activeKey
'
]);
const
{
pageConfig
,
shopId
,
selectedInfo
}
=
useSelector
([
'pageConfig'
,
'shopId'
,
'selectedInfo
'
]);
const
{
isSelf
}
=
usePageStatus
();
/** 是否是自营商城 */
const
isSelfMall
=
useMemo
(()
=>
!!
isSelf
,
[
isSelf
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment