Skip to content

Commit

Permalink
perf(notify): use wxs (#3893)
Browse files Browse the repository at this point in the history
  • Loading branch information
rex-zsd committed Dec 22, 2020
1 parent 7378398 commit 5daa5cd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/notify/index.wxml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />

<van-transition
name="slide-down"
show="{{ show }}"
custom-class="van-notify__container"
custom-style="z-index: {{ zIndex }}; top: {{ utils.addUnit(top) }}"
custom-style="{{ computed.rootStyle({ zIndex, top }) }}"
bind:tap="onTap"
>
<view
class="van-notify van-notify--{{ type }}"
style="background:{{ background }};color:{{ color }};"
style="{{ computed.notifyStyle({ background, color }) }}"
>
<view
wx:if="{{ safeAreaInsetTop }}"
Expand Down
21 changes: 21 additions & 0 deletions packages/notify/index.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable */
var style = require('../wxs/style.wxs');

function rootStyle(data) {
return style({
'z-index': data.zIndex,
top: addUnit(data.top),
});
}

function notifyStyle(data) {
return style({
background: data.background,
color: data.color,
});
}

module.exports = {
rootStyle: rootStyle,
notifyStyle: notifyStyle,
};

0 comments on commit 5daa5cd

Please sign in to comment.