Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
b1af78f9
Commit
b1af78f9
authored
Dec 14, 2019
by
Junling Bu
Browse files
chore[litemall-wx]: 使用vant-weapp 1.0
parent
07351378
Changes
311
Hide whitespace changes
Inline
Side-by-side
litemall-wx/lib/vant-weapp/loading/index.js
0 → 100644
View file @
b1af78f9
import
{
VantComponent
}
from
'
../common/component
'
;
import
{
addUnit
}
from
'
../common/utils
'
;
VantComponent
({
props
:
{
color
:
String
,
vertical
:
Boolean
,
type
:
{
type
:
String
,
value
:
'
circular
'
},
size
:
{
type
:
String
,
observer
:
'
setSizeWithUnit
'
},
textSize
:
{
type
:
String
,
observer
:
'
setTextSizeWithUnit
'
}
},
methods
:
{
setSizeWithUnit
(
size
)
{
this
.
setData
({
sizeWithUnit
:
addUnit
(
size
)
});
},
setTextSizeWithUnit
(
size
)
{
this
.
set
({
textSizeWithUnit
:
addUnit
(
size
)
});
}
}
});
litemall-wx/lib/vant-weapp/loading/index.json
0 → 100644
View file @
b1af78f9
{
"component"
:
true
}
\ No newline at end of file
litemall-wx/lib/vant-weapp/loading/index.wxml
0 → 100644
View file @
b1af78f9
<view class="custom-class van-loading {{ vertical ? 'van-loading--vertical' : '' }}">
<view
class="van-loading__spinner van-loading__spinner--{{ type }}"
style="color: {{ color }}; width: {{ sizeWithUnit }}; height: {{ sizeWithUnit }}"
>
<view
wx:if="{{ type === 'spinner' }}"
wx:for="item in 12"
wx:key="index"
class="van-loading__dot"
/>
</view>
<view class="van-loading__text" style="font-size: {{ textSizeWithUnit }};">
<slot />
</view>
</view>
litemall-wx/lib/vant-weapp/loading/index.wxss
0 → 100644
View file @
b1af78f9
@import '../common/index.wxss';:host{font-size:0;line-height:1}.van-loading{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;color:#c8c9cc;color:var(--loading-spinner-color,#c8c9cc)}.van-loading__spinner{position:relative;box-sizing:border-box;width:30px;width:var(--loading-spinner-size,30px);max-width:100%;max-height:100%;height:30px;height:var(--loading-spinner-size,30px);-webkit-animation:van-rotate .8s linear infinite;animation:van-rotate .8s linear infinite;-webkit-animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite;animation:van-rotate var(--loading-spinner-animation-duration,.8s) linear infinite}.van-loading__spinner--spinner{-webkit-animation-timing-function:steps(12);animation-timing-function:steps(12)}.van-loading__spinner--circular{border:1px solid transparent;border-top-color:initial;border-radius:100%}.van-loading__text{margin-left:8px;margin-left:var(--padding-xs,8px);color:#969799;color:var(--loading-text-color,#969799);font-size:14px;font-size:var(--loading-text-font-size,14px);line-height:20px;line-height:var(--loading-text-line-height,20px)}.van-loading__text:empty{display:none}.van-loading--vertical{-webkit-flex-direction:column;flex-direction:column}.van-loading--vertical .van-loading__text{margin:8px 0 0;margin:var(--padding-xs,8px) 0 0}.van-loading__dot{position:absolute;top:0;left:0;width:100%;height:100%}.van-loading__dot:before{display:block;width:2px;height:25%;margin:0 auto;background-color:currentColor;border-radius:40%;content:" "}.van-loading__dot:first-of-type{-webkit-transform:rotate(30deg);transform:rotate(30deg);opacity:1}.van-loading__dot:nth-of-type(2){-webkit-transform:rotate(60deg);transform:rotate(60deg);opacity:.9375}.van-loading__dot:nth-of-type(3){-webkit-transform:rotate(90deg);transform:rotate(90deg);opacity:.875}.van-loading__dot:nth-of-type(4){-webkit-transform:rotate(120deg);transform:rotate(120deg);opacity:.8125}.van-loading__dot:nth-of-type(5){-webkit-transform:rotate(150deg);transform:rotate(150deg);opacity:.75}.van-loading__dot:nth-of-type(6){-webkit-transform:rotate(180deg);transform:rotate(180deg);opacity:.6875}.van-loading__dot:nth-of-type(7){-webkit-transform:rotate(210deg);transform:rotate(210deg);opacity:.625}.van-loading__dot:nth-of-type(8){-webkit-transform:rotate(240deg);transform:rotate(240deg);opacity:.5625}.van-loading__dot:nth-of-type(9){-webkit-transform:rotate(270deg);transform:rotate(270deg);opacity:.5}.van-loading__dot:nth-of-type(10){-webkit-transform:rotate(300deg);transform:rotate(300deg);opacity:.4375}.van-loading__dot:nth-of-type(11){-webkit-transform:rotate(330deg);transform:rotate(330deg);opacity:.375}.van-loading__dot:nth-of-type(12){-webkit-transform:rotate(1turn);transform:rotate(1turn);opacity:.3125}@-webkit-keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes van-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}
\ No newline at end of file
litemall-wx/lib/vant-weapp/nav-bar/index.d.ts
0 → 100644
View file @
b1af78f9
export
{};
litemall-wx/lib/vant-weapp/nav-bar/index.js
0 → 100644
View file @
b1af78f9
import
{
VantComponent
}
from
'
../common/component
'
;
VantComponent
({
classes
:
[
'
title-class
'
],
props
:
{
title
:
String
,
fixed
:
Boolean
,
leftText
:
String
,
rightText
:
String
,
leftArrow
:
Boolean
,
border
:
{
type
:
Boolean
,
value
:
true
},
zIndex
:
{
type
:
Number
,
value
:
1
},
safeAreaInsetTop
:
{
type
:
Boolean
,
value
:
true
},
},
data
:
{
statusBarHeight
:
0
},
created
()
{
const
{
statusBarHeight
}
=
wx
.
getSystemInfoSync
();
this
.
setData
({
statusBarHeight
});
},
methods
:
{
onClickLeft
()
{
this
.
$emit
(
'
click-left
'
);
},
onClickRight
()
{
this
.
$emit
(
'
click-right
'
);
}
}
});
litemall-wx/lib/vant-weapp/nav-bar/index.json
0 → 100644
View file @
b1af78f9
{
"component"
:
true
,
"usingComponents"
:
{
"van-icon"
:
"../icon/index"
}
}
litemall-wx/lib/vant-weapp/nav-bar/index.wxml
0 → 100644
View file @
b1af78f9
<wxs src="../wxs/utils.wxs" module="utils" />
<view
class="{{ utils.bem('nav-bar', { fixed }) }} custom-class {{ border ? 'van-hairline--bottom' : '' }}"
style="z-index: {{ zIndex }}; padding-top: {{ safeAreaInsetTop ? statusBarHeight : 0 }}px;"
>
<view class="van-nav-bar__left" bind:tap="onClickLeft">
<block wx:if="{{ leftArrow || leftText }}">
<van-icon
wx:if="{{ leftArrow }}"
size="16px"
name="arrow-left"
custom-class="van-nav-bar__arrow"
/>
<view
wx:if="{{ leftText }}"
class="van-nav-bar__text"
hover-class="van-nav-bar__text--hover"
hover-stay-time="70"
>{{ leftText }}</view>
</block>
<slot wx:else name="left" />
</view>
<view class="van-nav-bar__title title-class van-ellipsis">
<block wx:if="{{ title }}">{{ title }}</block>
<slot wx:else name="title" />
</view>
<view class="van-nav-bar__right" bind:tap="onClickRight">
<view
wx:if="{{ rightText }}"
class="van-nav-bar__text"
hover-class="van-nav-bar__text--hover"
hover-stay-time="70"
>{{ rightText }}</view>
<slot wx:else name="right" />
</view>
</view>
litemall-wx/lib/vant-weapp/nav-bar/index.wxss
0 → 100644
View file @
b1af78f9
@import '../common/index.wxss';.van-nav-bar{position:relative;text-align:center;-webkit-user-select:none;user-select:none;height:44px;height:var(--nav-bar-height,44px);line-height:44px;line-height:var(--nav-bar-height,44px);background-color:#fff;background-color:var(--nav-bar-background-color,#fff)}.van-nav-bar__text{display:inline-block;vertical-align:middle;margin:0 -16px;margin:0 -var(--padding-md,16px);padding:0 16px;padding:0 var(--padding-md,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__text--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-nav-bar__arrow{vertical-align:middle;font-size:16px;font-size:var(--nav-bar-arrow-size,16px);color:#1989fa;color:var(--nav-bar-text-color,#1989fa)}.van-nav-bar__arrow+.van-nav-bar__text{margin-left:-20px;padding-left:25px}.van-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.van-nav-bar__title{max-width:60%;margin:0 auto;color:#323233;color:var(--nav-bar-title-text-color,#323233);font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--nav-bar-title-font-size,16px)}.van-nav-bar__left,.van-nav-bar__right{position:absolute;bottom:0;font-size:14px;font-size:var(--font-size-md,14px)}.van-nav-bar__left{left:16px;left:var(--padding-md,16px)}.van-nav-bar__right{right:16px;right:var(--padding-md,16px)}
\ No newline at end of file
litemall-wx/lib/vant-weapp/notice-bar/index.d.ts
0 → 100644
View file @
b1af78f9
export
{};
litemall-wx/lib/vant-weapp/notice-bar/index.js
0 → 100644
View file @
b1af78f9
import
{
VantComponent
}
from
'
../common/component
'
;
const
FONT_COLOR
=
'
#ed6a0c
'
;
const
BG_COLOR
=
'
#fffbe8
'
;
VantComponent
({
props
:
{
text
:
{
type
:
String
,
value
:
''
},
mode
:
{
type
:
String
,
value
:
''
},
url
:
{
type
:
String
,
value
:
''
},
openType
:
{
type
:
String
,
value
:
'
navigate
'
},
delay
:
{
type
:
Number
,
value
:
1
},
speed
:
{
type
:
Number
,
value
:
50
},
scrollable
:
{
type
:
Boolean
,
value
:
true
},
leftIcon
:
{
type
:
String
,
value
:
''
},
color
:
{
type
:
String
,
value
:
FONT_COLOR
},
backgroundColor
:
{
type
:
String
,
value
:
BG_COLOR
},
wrapable
:
Boolean
},
data
:
{
show
:
true
},
watch
:
{
text
()
{
this
.
setData
({},
this
.
init
);
}
},
created
()
{
this
.
resetAnimation
=
wx
.
createAnimation
({
duration
:
0
,
timingFunction
:
'
linear
'
});
},
destroyed
()
{
this
.
timer
&&
clearTimeout
(
this
.
timer
);
},
methods
:
{
init
()
{
Promise
.
all
([
this
.
getRect
(
'
.van-notice-bar__content
'
),
this
.
getRect
(
'
.van-notice-bar__wrap
'
)
]).
then
((
rects
)
=>
{
const
[
contentRect
,
wrapRect
]
=
rects
;
if
(
contentRect
==
null
||
wrapRect
==
null
||
!
contentRect
.
width
||
!
wrapRect
.
width
)
{
return
;
}
const
{
speed
,
scrollable
,
delay
}
=
this
.
data
;
if
(
scrollable
&&
wrapRect
.
width
<
contentRect
.
width
)
{
const
duration
=
(
contentRect
.
width
/
speed
)
*
1000
;
this
.
wrapWidth
=
wrapRect
.
width
;
this
.
contentWidth
=
contentRect
.
width
;
this
.
duration
=
duration
;
this
.
animation
=
wx
.
createAnimation
({
duration
,
timingFunction
:
'
linear
'
,
delay
});
this
.
scroll
();
}
});
},
scroll
()
{
this
.
timer
&&
clearTimeout
(
this
.
timer
);
this
.
timer
=
null
;
this
.
setData
({
animationData
:
this
.
resetAnimation
.
translateX
(
this
.
wrapWidth
)
.
step
()
.
export
()
});
setTimeout
(()
=>
{
this
.
setData
({
animationData
:
this
.
animation
.
translateX
(
-
this
.
contentWidth
)
.
step
()
.
export
()
});
},
20
);
this
.
timer
=
setTimeout
(()
=>
{
this
.
scroll
();
},
this
.
duration
);
},
onClickIcon
()
{
this
.
timer
&&
clearTimeout
(
this
.
timer
);
this
.
timer
=
null
;
this
.
setData
({
show
:
false
});
},
onClick
(
event
)
{
this
.
$emit
(
'
click
'
,
event
);
}
}
});
litemall-wx/lib/vant-weapp/notice-bar/index.json
0 → 100644
View file @
b1af78f9
{
"component"
:
true
,
"usingComponents"
:
{
"van-icon"
:
"../icon/index"
}
}
\ No newline at end of file
litemall-wx/lib/vant-weapp/notice-bar/index.wxml
0 → 100644
View file @
b1af78f9
<wxs src="../wxs/utils.wxs" module="utils" />
<view
wx:if="{{ show }}"
class="custom-class {{ utils.bem('notice-bar', { withicon: mode, wrapable }) }}"
style="color: {{ color }}; background-color: {{ backgroundColor }};"
bind:tap="onClick"
>
<van-icon
wx:if="{{ leftIcon }}"
size="16px"
name="{{ leftIcon }}"
class="van-notice-bar__left-icon"
/>
<slot wx:else name="left-icon" />
<view class="van-notice-bar__wrap">
<view class="van-notice-bar__content {{ !scrollable && !wrapable ? 'van-ellipsis' : '' }}" animation="{{ animationData }}">
{{ text }}
</view>
</view>
<van-icon
wx:if="{{ mode === 'closeable' }}"
class="van-notice-bar__right-icon"
name="cross"
catch:tap="onClickIcon"
/>
<navigator
wx:elif="{{ mode === 'link' }}"
url="{{ url }}"
open-type="{{ openType }}"
>
<van-icon class="van-notice-bar__right-icon" name="arrow" />
</navigator>
<slot wx:else name="right-icon" />
</view>
litemall-wx/lib/vant-weapp/notice-bar/index.wxss
0 → 100644
View file @
b1af78f9
@import '../common/index.wxss';.van-notice-bar{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;height:40px;height:var(--notice-bar-height,40px);padding:0 16px;padding:var(--notice-bar-padding,0 16px);font-size:14px;font-size:var(--notice-bar-font-size,14px);color:#ed6a0c;color:var(--notice-bar-text-color,#ed6a0c);line-height:24px;line-height:var(--notice-bar-line-height,24px);background-color:#fffbe8;background-color:var(--notice-bar-background-color,#fffbe8)}.van-notice-bar--withicon{position:relative;padding-right:40px}.van-notice-bar--wrapable{height:auto;padding:8px 16px;padding:var(--notice-bar-wrapable-padding,8px 16px)}.van-notice-bar--wrapable .van-notice-bar__wrap{height:auto}.van-notice-bar--wrapable .van-notice-bar__content{position:relative;white-space:normal}.van-notice-bar__left-icon{display:-webkit-flex;display:flex;-webkit-align-items:center;align-items:center;margin-right:4px;vertical-align:middle}.van-notice-bar__left-icon,.van-notice-bar__right-icon{font-size:16px;font-size:var(--notice-bar-icon-size,16px);min-width:22px;min-width:var(--notice-bar-icon-min-width,22px)}.van-notice-bar__right-icon{position:absolute;top:10px;right:15px}.van-notice-bar__wrap{position:relative;-webkit-flex:1;flex:1;overflow:hidden;height:24px;height:var(--notice-bar-line-height,24px)}.van-notice-bar__content{position:absolute;white-space:nowrap}.van-notice-bar__content.van-ellipsis{max-width:100%}
\ No newline at end of file
litemall-wx/lib/vant-weapp/notify/index.d.ts
0 → 100644
View file @
b1af78f9
export
{};
litemall-wx/lib/vant-weapp/notify/index.js
0 → 100644
View file @
b1af78f9
import
{
VantComponent
}
from
'
../common/component
'
;
import
{
WHITE
}
from
'
../common/color
'
;
VantComponent
({
props
:
{
message
:
String
,
background
:
String
,
type
:
{
type
:
String
,
value
:
'
danger
'
},
color
:
{
type
:
String
,
value
:
WHITE
},
duration
:
{
type
:
Number
,
value
:
3000
},
zIndex
:
{
type
:
Number
,
value
:
110
},
safeAreaInsetTop
:
{
type
:
Boolean
,
value
:
false
}
},
created
()
{
const
{
statusBarHeight
}
=
wx
.
getSystemInfoSync
();
this
.
setData
({
statusBarHeight
});
},
methods
:
{
show
()
{
const
{
duration
,
onOpened
}
=
this
.
data
;
clearTimeout
(
this
.
timer
);
this
.
setData
({
show
:
true
},
onOpened
);
if
(
duration
>
0
&&
duration
!==
Infinity
)
{
this
.
timer
=
setTimeout
(()
=>
{
this
.
hide
();
},
duration
);
}
},
hide
()
{
const
{
onClose
}
=
this
.
data
;
clearTimeout
(
this
.
timer
);
this
.
setData
({
show
:
false
},
onClose
);
},
onTap
(
event
)
{
const
{
onClick
}
=
this
.
data
;
if
(
onClick
)
{
onClick
(
event
.
detail
);
}
}
}
});
litemall-wx/lib/vant-weapp/notify/index.json
0 → 100644
View file @
b1af78f9
{
"component"
:
true
,
"usingComponents"
:
{
"van-transition"
:
"../transition/index"
}
}
litemall-wx/lib/vant-weapp/notify/index.wxml
0 → 100644
View file @
b1af78f9
<van-transition
name="slide-down"
show="{{ show }}"
custom-class="van-notify__container"
custom-style="z-index: {{ zIndex }};"
bind:tap="onTap"
>
<view
class="van-notify van-notify--{{ type }}"
style="background:{{ background }};color:{{ color }};"
>
<view wx:if="{{ safeAreaInsetTop }}" class="van-notify__safe-area"></view>
<text>{{ message }}</text>
</view>
</van-transition>
litemall-wx/lib/vant-weapp/notify/index.wxss
0 → 100644
View file @
b1af78f9
@import '../common/index.wxss';.van-notify{text-align:center;word-wrap:break-word;padding:6px 15px;padding:var(--notify-padding,6px 15px);font-size:14px;font-size:var(--notify-font-size,14px);line-height:20px;line-height:var(--notify-line-height,20px)}.van-notify__container{position:fixed;top:0;box-sizing:border-box;width:100%}.van-notify--primary{background-color:#1989fa;background-color:var(--notify-primary-background-color,#1989fa)}.van-notify--success{background-color:#07c160;background-color:var(--notify-success-background-color,#07c160)}.van-notify--danger{background-color:#ee0a24;background-color:var(--notify-danger-background-color,#ee0a24)}.van-notify--warning{background-color:#ff976a;background-color:var(--notify-warning-background-color,#ff976a)}
\ No newline at end of file
litemall-wx/lib/vant-weapp/notify/notify.d.ts
0 → 100644
View file @
b1af78f9
interface
NotifyOptions
{
type
?:
'
primary
'
|
'
success
'
|
'
danger
'
|
'
warning
'
;
color
?:
string
;
zIndex
?:
number
;
message
:
string
;
context
?:
any
;
duration
?:
number
;
selector
?:
string
;
background
?:
string
;
safeAreaInsetTop
?:
boolean
;
onClick
?:
()
=>
void
;
onOpened
?:
()
=>
void
;
onClose
?:
()
=>
void
;
}
declare
function
Notify
(
options
:
NotifyOptions
|
string
):
any
;
declare
namespace
Notify
{
var
clear
:
(
options
?:
NotifyOptions
)
=>
void
;
}
export
default
Notify
;
Prev
1
…
4
5
6
7
8
9
10
11
12
…
16
Next
Write
Preview
Supports
Markdown
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