Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
user
Overview
Overview
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
hooloo
mp
user
Commits
6fbb34ee
Commit
6fbb34ee
authored
Aug 01, 2022
by
songbingqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成首页分类图片自适应添加
parent
4ca0c286
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
components/menuAssembly/index.vue
+23
-4
No files found.
components/menuAssembly/index.vue
View file @
6fbb34ee
<
template
>
<
template
>
<view
class=
"page-body"
>
<view
class=
"page-body"
>
<scroll-view
class=
"nav-left"
:style=
"[heightStyle]"
:class=
"[shopCarFlag||shopState===0?'shopCarcss':'' ]"
scroll-y
:scroll-top=
"scrollLeftTop"
scroll-with-animation
>
<scroll-view
class=
"nav-left"
:style=
"[heightStyle]"
:class=
"[shopCarFlag||shopState===0?'shopCarcss':'' ]"
scroll-y
:scroll-top=
"scrollLeftTop"
scroll-with-animation
>
<view
class=
"nav-left-item"
v-for=
"
item
in classifyData"
@
click=
"categoryClickMain(item.id)"
:key=
"item.id"
<view
class=
"nav-left-item"
v-for=
"
(item,index)
in classifyData"
@
click=
"categoryClickMain(item.id)"
:key=
"item.id"
:class=
"item.id == categoryId ? 'active' : ''"
>
:class=
"item.id == categoryId ? 'active' : ''"
>
<
!--
<view
class=
"imgbox"
><image
:style=
"
{'height':'100%','width':'100%'}" :src="'../../static/imgs/image_50_50.png'"/>
</view>
--
>
<
view
class=
"imgbox"
v-if=
"item.src"
><image
:style=
"
{'height':sizeList[index].height+'rpx','width':sizeList[index].width+'rpx'}" :src="item.src"/>
</view
>
<view><span>
{{
item
.
name
}}
</span></view>
<view><span>
{{
item
.
name
}}
</span></view>
<!--
<view
:class=
"item.id == categoryId ? 'active-line' : ''"
></view>
-->
<!--
<view
:class=
"item.id == categoryId ? 'active-line' : ''"
></view>
-->
</view>
</view>
...
@@ -69,7 +69,9 @@ export default {
...
@@ -69,7 +69,9 @@ export default {
goods
:[],
goods
:[],
shopCarFlag
:
false
,
shopCarFlag
:
false
,
taBarHeight
:
0
,
taBarHeight
:
0
,
lastNumber
:
0
lastNumber
:
0
,
width
:
0
,
sizeList
:[]
}
}
},
},
watch
:{
watch
:{
...
@@ -113,6 +115,12 @@ export default {
...
@@ -113,6 +115,12 @@ export default {
this
.
categoryPostion
=
data
this
.
categoryPostion
=
data
}).
exec
();
}).
exec
();
})
})
categorys
[
0
]?
categorys
[
0
].
src
=
'http://fakeimg.pl/70x50/'
:
''
categorys
[
1
]?
categorys
[
1
].
src
=
'http://fakeimg.pl/80x60/'
:
''
categorys
[
2
]?
categorys
[
2
].
src
=
'http://fakeimg.pl/90x50/'
:
''
categorys
.
map
(
item
=>
{
this
.
imagesHeight
(
item
.
src
)
})
return
categorys
return
categorys
}
}
},
},
...
@@ -130,6 +138,16 @@ export default {
...
@@ -130,6 +138,16 @@ export default {
});
});
},
},
methods
:
{
methods
:
{
async
imagesHeight
(
src
)
{
const
val
=
await
uni
.
getImageInfo
({
src
})
console
.
log
(
val
[
1
].
width
)
this
.
sizeList
.
push
({
width
:
val
[
1
].
width
,
height
:
val
[
1
].
height
})
},
getSku
(
data
)
{
getSku
(
data
)
{
const
{
skus
}
=
data
;
const
{
skus
}
=
data
;
if
(
!
skus
||
skus
.
length
==
0
)
{
if
(
!
skus
||
skus
.
length
==
0
)
{
...
@@ -249,7 +267,8 @@ export default {
...
@@ -249,7 +267,8 @@ export default {
.imgbox
{
.imgbox
{
height
:
auto
;
height
:
auto
;
width
:
50%
;
width
:
100%
;
text-align
:
center
;
}
}
}
}
...
...
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