Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
37d55bc2
Commit
37d55bc2
authored
Oct 21, 2023
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公告组件动态计算高度
parent
db468fbd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
static/nativeComponents/Notice/index.js
+14
-1
static/nativeComponents/Notice/index.wxml
+1
-1
static/vant/tabs/index.js
+6
-3
No files found.
static/nativeComponents/Notice/index.js
View file @
37d55bc2
...
...
@@ -18,10 +18,12 @@ Component({
singleImg
:
''
,
CommonHeight
:
0
,
NoticeMargin
:
0
,
NoticePadding
:
0
NoticePadding
:
0
,
imgArr
:
[],
},
ready
()
{
console
.
log
(
"notice---ready"
);
let
{
noticeList
,
singleImage
}
=
this
.
data
.
datas
.
componentData
singleImage
=
DFSImg
(
singleImage
)
for
(
let
i
=
0
;
i
<
noticeList
.
length
;
i
++
)
{
...
...
@@ -41,6 +43,17 @@ Component({
* 组件的方法列表
*/
methods
:
{
bindload
(
e
)
{
let
{
imageWidth
}
=
this
.
data
.
datas
.
componentData
;
let
index
=
e
.
currentTarget
.
dataset
.
index
;
let
width
=
e
.
detail
.
width
let
height
=
e
.
detail
.
height
let
useHeight
=
imageWidth
/
width
*
height
;
this
.
setData
({
[
`imgArr[
${
index
}
].height`
]:
useHeight
,
})
},
onclickHandle
(
e
)
{
let
item
=
this
.
data
.
datas
.
componentData
.
noticeList
[
e
.
currentTarget
.
dataset
.
index
]
app
.
trackCpn
(
e
,
this
.
data
.
datas
.
componentName
,
item
)
...
...
static/nativeComponents/Notice/index.wxml
View file @
37d55bc2
...
...
@@ -5,7 +5,7 @@
<view class="container" bindtap="onclickHandle" data-index="{{index}}" style="width: 100%;height:{{CommonHeight}}">
<block wx:if="{{item.imageUrl||datas.componentData.singleImage}}">
<view wx:if="{{datas.componentData.styleType===1}}">
<image class="notice-icon"
mode="widthFix" style="width:{{datas.componentData.imageWidth}}px !important;" src="{{item.imageUrl
}}" />
<image class="notice-icon"
style="width:{{datas.componentData.imageWidth}}px !important; height: {{imgArr[index].height}}px" src="{{item.imageUrl}}" bindload="bindload" data-index="{{index
}}" />
</view>
<view wx:else>
<image class="notice-icon" mode="widthFix" style="width:{{datas.componentData.imageWidth}}px !important;" src="{{singleImg}}" />
...
...
static/vant/tabs/index.js
View file @
37d55bc2
...
...
@@ -31,8 +31,12 @@ VantComponent({
sticky
:
Boolean
,
border
:
Boolean
,
swipeable
:
Boolean
,
titleActiveColor
:
String
,
titleInactiveColor
:
String
,
titleActiveColor
:
{
type
:
[
String
,
null
]
},
titleInactiveColor
:
{
type
:
[
String
,
null
]
},
color
:
String
,
datas
:
Object
,
animated
:
{
...
...
@@ -49,7 +53,6 @@ VantComponent({
// observer: "resize"
},
lineLengthType
:
{
type
:
[
String
,
Number
],
value
:
1
// 1默认自适应 2短自适应 3 固定宽度取值lineWidth
},
linePosition
:
{
...
...
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