Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
飞
飞鹤小程序
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
FH
飞鹤小程序
Commits
8e379ceb
Commit
8e379ceb
authored
Jun 05, 2025
by
张九刚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: backup
parent
4da49b96
Changes
68
Show whitespace changes
Inline
Side-by-side
Showing
68 changed files
with
1768 additions
and
17 deletions
+1768
-17
App.vue
App.vue
+2
-1
pages.json
pages.json
+9
-6
search.vue
pages/search/search.vue
+190
-9
test.png
static/searchpage/test.png
+0
-0
test2.png
static/searchpage/test2.png
+0
-0
test3.png
static/searchpage/test3.png
+0
-0
Home.vue
views/Home.vue
+1
-1
color.d.ts
wxcomponents/vant/common/color.d.ts
+7
-0
color.js
wxcomponents/vant/common/color.js
+7
-0
component.d.ts
wxcomponents/vant/common/component.d.ts
+4
-0
component.js
wxcomponents/vant/common/component.js
+46
-0
index.wxss
wxcomponents/vant/common/index.wxss
+1
-0
relation.d.ts
wxcomponents/vant/common/relation.d.ts
+15
-0
relation.js
wxcomponents/vant/common/relation.js
+56
-0
clearfix.wxss
wxcomponents/vant/common/style/clearfix.wxss
+1
-0
ellipsis.wxss
wxcomponents/vant/common/style/ellipsis.wxss
+1
-0
hairline.wxss
wxcomponents/vant/common/style/hairline.wxss
+1
-0
clearfix.wxss
wxcomponents/vant/common/style/mixins/clearfix.wxss
+0
-0
ellipsis.wxss
wxcomponents/vant/common/style/mixins/ellipsis.wxss
+0
-0
hairline.wxss
wxcomponents/vant/common/style/mixins/hairline.wxss
+0
-0
var.wxss
wxcomponents/vant/common/style/var.wxss
+0
-0
utils.d.ts
wxcomponents/vant/common/utils.d.ts
+21
-0
utils.js
wxcomponents/vant/common/utils.js
+86
-0
validator.d.ts
wxcomponents/vant/common/validator.d.ts
+9
-0
validator.js
wxcomponents/vant/common/validator.js
+31
-0
version.d.ts
wxcomponents/vant/common/version.d.ts
+15
-0
version.js
wxcomponents/vant/common/version.js
+59
-0
index.d.ts
wxcomponents/vant/info/index.d.ts
+1
-0
index.js
wxcomponents/vant/info/index.js
+8
-0
index.json
wxcomponents/vant/info/index.json
+3
-0
index.wxml
wxcomponents/vant/info/index.wxml
+7
-0
index.wxss
wxcomponents/vant/info/index.wxss
+1
-0
basic.d.ts
wxcomponents/vant/mixins/basic.d.ts
+1
-0
basic.js
wxcomponents/vant/mixins/basic.js
+26
-0
button.d.ts
wxcomponents/vant/mixins/button.d.ts
+1
-0
button.js
wxcomponents/vant/mixins/button.js
+51
-0
link.d.ts
wxcomponents/vant/mixins/link.d.ts
+1
-0
link.js
wxcomponents/vant/mixins/link.js
+23
-0
page-scroll.d.ts
wxcomponents/vant/mixins/page-scroll.d.ts
+6
-0
page-scroll.js
wxcomponents/vant/mixins/page-scroll.js
+42
-0
touch.d.ts
wxcomponents/vant/mixins/touch.d.ts
+1
-0
touch.js
wxcomponents/vant/mixins/touch.js
+37
-0
transition.d.ts
wxcomponents/vant/mixins/transition.d.ts
+1
-0
transition.js
wxcomponents/vant/mixins/transition.js
+136
-0
index.d.ts
wxcomponents/vant/sticky/index.d.ts
+1
-0
index.js
wxcomponents/vant/sticky/index.js
+120
-0
index.json
wxcomponents/vant/sticky/index.json
+3
-0
index.wxml
wxcomponents/vant/sticky/index.wxml
+8
-0
index.wxs
wxcomponents/vant/sticky/index.wxs
+25
-0
index.wxss
wxcomponents/vant/sticky/index.wxss
+1
-0
index.d.ts
wxcomponents/vant/tab/index.d.ts
+1
-0
index.js
wxcomponents/vant/tab/index.js
+56
-0
index.json
wxcomponents/vant/tab/index.json
+3
-0
index.wxml
wxcomponents/vant/tab/index.wxml
+8
-0
index.wxss
wxcomponents/vant/tab/index.wxss
+1
-0
index.d.ts
wxcomponents/vant/tabs/index.d.ts
+1
-0
index.js
wxcomponents/vant/tabs/index.js
+302
-0
index.json
wxcomponents/vant/tabs/index.json
+7
-0
index.wxml
wxcomponents/vant/tabs/index.wxml
+63
-0
index.wxs
wxcomponents/vant/tabs/index.wxs
+83
-0
index.wxss
wxcomponents/vant/tabs/index.wxss
+1
-0
add-unit.wxs
wxcomponents/vant/wxs/add-unit.wxs
+12
-0
array.wxs
wxcomponents/vant/wxs/array.wxs
+5
-0
bem.wxs
wxcomponents/vant/wxs/bem.wxs
+39
-0
memoize.wxs
wxcomponents/vant/wxs/memoize.wxs
+55
-0
object.wxs
wxcomponents/vant/wxs/object.wxs
+13
-0
style.wxs
wxcomponents/vant/wxs/style.wxs
+42
-0
utils.wxs
wxcomponents/vant/wxs/utils.wxs
+10
-0
No files found.
App.vue
View file @
8e379ceb
...
...
@@ -13,6 +13,7 @@ export default {
</
script
>
<
style
lang=
"less"
>
@import '/wxcomponents/vant/common/index.wxss';
/*每个页面公共css */
::-webkit-scrollbar {
display: none;
...
...
pages.json
View file @
8e379ceb
...
...
@@ -7,10 +7,9 @@
}
},
{
"path"
:
"pages/search/search"
,
"style"
:
{
"navigationBarTitleText"
:
""
"path"
:
"pages/search/search"
,
"style"
:
{
"navigationBarTitleText"
:
""
}
}
],
...
...
@@ -19,7 +18,11 @@
"navigationBarTitleText"
:
"uni-app"
,
"navigationBarBackgroundColor"
:
"#F8F8F8"
,
"backgroundColor"
:
"#F8F8F8"
,
"navigationStyle"
:
"custom"
"navigationStyle"
:
"custom"
,
"usingComponents"
:
{
"van-tab"
:
"wxcomponents/vant/tab/index"
,
"van-tabs"
:
"wxcomponents/vant/tabs/index"
}
},
"uniIdRouter"
:
{}
}
\ No newline at end of file
pages/search/search.vue
View file @
8e379ceb
<
template
>
<view
class=
"container"
>
<view
class=
"searchBar"
:style=
"`top:$
{statusBarHeight
*2-5}r
px`">
<image
class=
"btnback"
:src=
"baseImgUrl+'/static/searchpage/btnback.png'"
></image>
<view
class=
"searchBar"
:style=
"`top:$
{statusBarHeight
}
px`">
<image
@
tap=
"backHandler"
class=
"btnback"
:src=
"baseImgUrl+'/static/searchpage/btnback.png'"
></image>
<view
class=
"input-view"
>
<view
class=
"flexinput"
>
<image
class=
"icon_search_yellow"
:src=
"baseImgUrl+'/static/searchpage/icon_search_yellow.png'"
>
...
...
@@ -11,7 +11,7 @@
</view>
</view>
</view>
<view
class=
"topbox"
:style=
"`margin-top:$
{statusBarHeight
*2+32}r
px`">
<view
class=
"topbox"
:style=
"`margin-top:$
{statusBarHeight
+10}
px`">
<view
v-if=
"step === 1"
class=
"recentbox"
>
<image
class=
"icon_trash"
:src=
"baseImgUrl+'/static/searchpage/icon_trash.png'"
></image>
<view
class=
"title"
>
最近搜索
</view>
...
...
@@ -28,9 +28,22 @@
</view>
<view
v-if=
"step !== 1"
class=
"tabbox"
>
<van-tabs
:color=
"`#d3a358`"
:active=
"tabIndex"
@
click=
"onTabChange"
>
<van-tab
title=
"内容"
name=
"a"
></van-tab>
<van-tab
title=
"工具"
name=
"b"
></van-tab>
<van-tab
title=
"商品"
name=
"c"
></van-tab>
</van-tabs>
</view>
<view
v-if=
"step !== 1"
class=
"cardbox"
>
<view
class=
"card"
v-for=
"(item,index) in resultList[tabIndex]"
:key=
"index"
>
<image
class=
"pic"
:src=
"baseImgUrl+item.bgUrl"
></image>
<view
class=
"desc"
>
{{
item
.
desc
}}
</view>
<view
class=
"timestr"
>
{{
item
.
timeStr
}}
</view>
</view>
</view>
</view>
...
...
@@ -46,6 +59,122 @@
const
oftenTagsList
=
[
"功能营养"
,
"母婴"
,
"功能营养"
,
"母婴"
,
"功能营养"
,
"母婴"
,
"功能营养"
,
"母婴"
,
"功能营养"
,
"母婴"
]
const
resultList
=
[
[
{
bgUrl
:
"/static/searchpage/test.png"
,
desc
:
"宝宝出生必做6件事,90 %爸妈漏掉第3条"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test.png"
,
desc
:
"宝宝出生必做6件事,90 %爸妈漏掉第3条"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test.png"
,
desc
:
"宝宝出生必做6件事,90 %爸妈漏掉第3条"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test.png"
,
desc
:
"宝宝出生必做6件事,90 %爸妈漏掉第3条"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test.png"
,
desc
:
"宝宝出生必做6件事,90 %爸妈漏掉第3条"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test.png"
,
desc
:
"宝宝出生必做6件事,90 %爸妈漏掉第3条"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test.png"
,
desc
:
"宝宝出生必做6件事,90 %爸妈漏掉第3条"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test.png"
,
desc
:
"宝宝出生必做6件事,90 %爸妈漏掉第3条"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
}
],
[
{
bgUrl
:
"/static/searchpage/test2.png"
,
desc
:
"秋风渐凉,宝宝的免疫力 也进入 “换季挑战期”"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test2.png"
,
desc
:
"秋风渐凉,宝宝的免疫力 也进入 “换季挑战期”"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test2.png"
,
desc
:
"秋风渐凉,宝宝的免疫力 也进入 “换季挑战期”"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test2.png"
,
desc
:
"秋风渐凉,宝宝的免疫力 也进入 “换季挑战期”"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test2.png"
,
desc
:
"秋风渐凉,宝宝的免疫力 也进入 “换季挑战期”"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
],
[
{
bgUrl
:
"/static/searchpage/test3.png"
,
desc
:
"3 个 0 成本游戏,让宝宝 越玩越聪明~"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test3.png"
,
desc
:
"3 个 0 成本游戏,让宝宝 越玩越聪明~"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test3.png"
,
desc
:
"3 个 0 成本游戏,让宝宝 越玩越聪明~"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test3.png"
,
desc
:
"3 个 0 成本游戏,让宝宝 越玩越聪明~"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
{
bgUrl
:
"/static/searchpage/test3.png"
,
desc
:
"3 个 0 成本游戏,让宝宝 越玩越聪明~"
,
timeStr
:
"2025-03-10"
,
link
:
"www.baidu.com"
},
]
]
export
default
{
data
()
{
...
...
@@ -54,7 +183,10 @@
statusBarHeight
:
38
,
recentTagsList
:
recentTagsList
,
oftenTagsList
:
oftenTagsList
,
step
:
1
step
:
2
,
resultList
:
resultList
,
tabIndex
:
0
,
searchValue
:
''
}
},
mounted
()
{
...
...
@@ -62,8 +194,18 @@
this
.
statusBarHeight
=
systemInfo
.
statusBarHeight
||
38
;
},
methods
:
{
back
()
{
back
Handler
()
{
uni
.
navigateBack
();
},
onTabChange
(
evt
)
{
this
.
tabIndex
=
evt
.
detail
.
index
;
},
confirm
(
evt
){
this
.
searchValue
=
evt
.
detail
.
value
;
},
searchHandler
(){
}
}
}
...
...
@@ -71,10 +213,19 @@
<
style
lang=
"less"
scoped
>
@import '@/common.less';
:root{
--tab-font-size:28rpx;
--tab-active-text-color:#1d1e25;
--tab-text-color:#a2a3a6;
}
.container {
background-color: #f6f8fa;
min-height: 100vh;
.tabbox{
width: 600rpx;
margin: 0 auto;
}
.searchBar {
display: flex;
position: relative;
...
...
@@ -82,7 +233,7 @@
.btnback {
width: 50rpx;
height: 50rpx;
left:
4
8rpx;
left:
3
8rpx;
position: relative;
}
.flexinput {
...
...
@@ -148,6 +299,36 @@
}
}
}
.cardbox
{
display: flex;
width: 750rpx;
padding-left: 24rpx;
padding-right: 24rpx;
background-color: white;
flex-wrap: wrap;
.card{
margin-top: 25rpx;
margin-right: 25rpx;
.pic{
width: 343rpx;
height: 343rpx;
}
.desc{
font-size: 26rpx;
width: 330rpx;
color: @color-black-deep;
}
.timestr{
font-size: 24rpx;
color: @color-black-medium;
margin-top: 10rpx;
}
}
}
}
...
...
static/searchpage/test.png
0 → 100644
View file @
8e379ceb
183 KB
static/searchpage/test2.png
0 → 100644
View file @
8e379ceb
200 KB
static/searchpage/test3.png
0 → 100644
View file @
8e379ceb
198 KB
views/Home.vue
View file @
8e379ceb
...
...
@@ -10,7 +10,7 @@
</view>
</swiper-item>
</swiper>
<view
class=
"barbox"
:style=
"`top:$
{statusBarHeight
*2-5}r
px;`">
<view
class=
"barbox"
:style=
"`top:$
{statusBarHeight
}
px;`">
<image
class=
"btnlogo"
:src=
"baseImgUrl+'/static/homepage/btnlogo.png'"
></image>
<image
class=
"btnsearch"
@
tap=
"goSearchHandler"
:src=
"baseImgUrl+'/static/homepage/btnsearch.png'"
></image>
<image
class=
"btncustomer"
:src=
"baseImgUrl+'/static/homepage/btncustomer.png'"
></image>
...
...
wxcomponents/vant/common/color.d.ts
0 → 100644
View file @
8e379ceb
export
declare
const
RED
=
"#ee0a24"
;
export
declare
const
BLUE
=
"#1989fa"
;
export
declare
const
WHITE
=
"#fff"
;
export
declare
const
GREEN
=
"#07c160"
;
export
declare
const
ORANGE
=
"#ff976a"
;
export
declare
const
GRAY
=
"#323233"
;
export
declare
const
GRAY_DARK
=
"#969799"
;
wxcomponents/vant/common/color.js
0 → 100644
View file @
8e379ceb
export
const
RED
=
'#ee0a24'
;
export
const
BLUE
=
'#1989fa'
;
export
const
WHITE
=
'#fff'
;
export
const
GREEN
=
'#07c160'
;
export
const
ORANGE
=
'#ff976a'
;
export
const
GRAY
=
'#323233'
;
export
const
GRAY_DARK
=
'#969799'
;
wxcomponents/vant/common/component.d.ts
0 → 100644
View file @
8e379ceb
/// <reference types="miniprogram-api-typings" />
import
{
VantComponentOptions
}
from
'definitions/index'
;
declare
function
VantComponent
<
Data
extends
WechatMiniprogram
.
Component
.
DataOption
,
Props
extends
WechatMiniprogram
.
Component
.
PropertyOption
,
Methods
extends
WechatMiniprogram
.
Component
.
MethodOption
>
(
vantOptions
:
VantComponentOptions
<
Data
,
Props
,
Methods
>
):
void
;
export
{
VantComponent
};
wxcomponents/vant/common/component.js
0 → 100644
View file @
8e379ceb
import
{
basic
}
from
'../mixins/basic'
;
function
mapKeys
(
source
,
target
,
map
)
{
Object
.
keys
(
map
).
forEach
((
key
)
=>
{
if
(
source
[
key
])
{
target
[
map
[
key
]]
=
source
[
key
];
}
});
}
function
VantComponent
(
vantOptions
)
{
const
options
=
{};
mapKeys
(
vantOptions
,
options
,
{
data
:
'data'
,
props
:
'properties'
,
watch
:
'observers'
,
mixins
:
'behaviors'
,
methods
:
'methods'
,
beforeCreate
:
'created'
,
created
:
'attached'
,
mounted
:
'ready'
,
destroyed
:
'detached'
,
classes
:
'externalClasses'
,
});
// add default externalClasses
options
.
externalClasses
=
options
.
externalClasses
||
[];
options
.
externalClasses
.
push
(
'custom-class'
);
// add default behaviors
options
.
behaviors
=
options
.
behaviors
||
[];
options
.
behaviors
.
push
(
basic
);
// add relations
const
{
relation
}
=
vantOptions
;
if
(
relation
)
{
options
.
relations
=
relation
.
relations
;
options
.
behaviors
.
push
(
relation
.
mixin
);
}
// map field to form-field behavior
if
(
vantOptions
.
field
)
{
options
.
behaviors
.
push
(
'wx://form-field'
);
}
// add default options
options
.
options
=
{
multipleSlots
:
true
,
addGlobalClass
:
true
,
};
Component
(
options
);
}
export
{
VantComponent
};
wxcomponents/vant/common/index.wxss
0 → 100644
View file @
8e379ceb
.van-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{clear:both;content:"";display:table}.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{border:0 solid #ebedf0;bottom:-50%;box-sizing:border-box;content:" ";left:-50%;pointer-events:none;position:absolute;right:-50%;top:-50%;transform:scale(.5);transform-origin:center}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
\ No newline at end of file
wxcomponents/vant/common/relation.d.ts
0 → 100644
View file @
8e379ceb
/// <reference types="miniprogram-api-typings" />
type
TrivialInstance
=
WechatMiniprogram
.
Component
.
TrivialInstance
;
export
declare
function
useParent
(
name
:
string
,
onEffect
?:
(
this
:
TrivialInstance
)
=>
void
):
{
relations
:
{
[
x
:
string
]:
WechatMiniprogram
.
Component
.
RelationOption
;
};
mixin
:
string
;
};
export
declare
function
useChildren
(
name
:
string
,
onEffect
?:
(
this
:
TrivialInstance
,
target
:
TrivialInstance
)
=>
void
):
{
relations
:
{
[
x
:
string
]:
WechatMiniprogram
.
Component
.
RelationOption
;
};
mixin
:
string
;
};
export
{};
wxcomponents/vant/common/relation.js
0 → 100644
View file @
8e379ceb
export
function
useParent
(
name
,
onEffect
)
{
const
path
=
`../
${
name
}
/index`
;
return
{
relations
:
{
[
path
]:
{
type
:
'ancestor'
,
linked
()
{
onEffect
&&
onEffect
.
call
(
this
);
},
linkChanged
()
{
onEffect
&&
onEffect
.
call
(
this
);
},
unlinked
()
{
onEffect
&&
onEffect
.
call
(
this
);
},
},
},
mixin
:
Behavior
({
created
()
{
Object
.
defineProperty
(
this
,
'parent'
,
{
get
:
()
=>
this
.
getRelationNodes
(
path
)[
0
],
});
Object
.
defineProperty
(
this
,
'index'
,
{
// @ts-ignore
get
:
()
=>
{
var
_a
,
_b
;
return
(
_b
=
(
_a
=
this
.
parent
)
===
null
||
_a
===
void
0
?
void
0
:
_a
.
children
)
===
null
||
_b
===
void
0
?
void
0
:
_b
.
indexOf
(
this
);
},
});
},
}),
};
}
export
function
useChildren
(
name
,
onEffect
)
{
const
path
=
`../
${
name
}
/index`
;
return
{
relations
:
{
[
path
]:
{
type
:
'descendant'
,
linked
(
target
)
{
onEffect
&&
onEffect
.
call
(
this
,
target
);
},
linkChanged
(
target
)
{
onEffect
&&
onEffect
.
call
(
this
,
target
);
},
unlinked
(
target
)
{
onEffect
&&
onEffect
.
call
(
this
,
target
);
},
},
},
mixin
:
Behavior
({
created
()
{
Object
.
defineProperty
(
this
,
'children'
,
{
get
:
()
=>
this
.
getRelationNodes
(
path
)
||
[],
});
},
}),
};
}
wxcomponents/vant/common/style/clearfix.wxss
0 → 100644
View file @
8e379ceb
.van-clearfix:after{clear:both;content:"";display:table}
\ No newline at end of file
wxcomponents/vant/common/style/ellipsis.wxss
0 → 100644
View file @
8e379ceb
.van-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden;text-overflow:ellipsis}.van-multi-ellipsis--l3{-webkit-line-clamp:3}
\ No newline at end of file
wxcomponents/vant/common/style/hairline.wxss
0 → 100644
View file @
8e379ceb
.van-hairline,.van-hairline--bottom,.van-hairline--left,.van-hairline--right,.van-hairline--surround,.van-hairline--top,.van-hairline--top-bottom{position:relative}.van-hairline--bottom:after,.van-hairline--left:after,.van-hairline--right:after,.van-hairline--surround:after,.van-hairline--top-bottom:after,.van-hairline--top:after,.van-hairline:after{border:0 solid #ebedf0;bottom:-50%;box-sizing:border-box;content:" ";left:-50%;pointer-events:none;position:absolute;right:-50%;top:-50%;transform:scale(.5);transform-origin:center}.van-hairline--top:after{border-top-width:1px}.van-hairline--left:after{border-left-width:1px}.van-hairline--right:after{border-right-width:1px}.van-hairline--bottom:after{border-bottom-width:1px}.van-hairline--top-bottom:after{border-width:1px 0}.van-hairline--surround:after{border-width:1px}
\ No newline at end of file
wxcomponents/vant/common/style/mixins/clearfix.wxss
0 → 100644
View file @
8e379ceb
wxcomponents/vant/common/style/mixins/ellipsis.wxss
0 → 100644
View file @
8e379ceb
wxcomponents/vant/common/style/mixins/hairline.wxss
0 → 100644
View file @
8e379ceb
wxcomponents/vant/common/style/var.wxss
0 → 100644
View file @
8e379ceb
wxcomponents/vant/common/utils.d.ts
0 → 100644
View file @
8e379ceb
/// <reference types="node" />
/// <reference types="miniprogram-api-typings" />
/// <reference types="miniprogram-api-typings" />
/// <reference types="miniprogram-api-typings" />
/// <reference types="miniprogram-api-typings" />
export
{
isDef
}
from
'./validator'
;
export
{
getSystemInfoSync
}
from
'./version'
;
export
declare
function
range
(
num
:
number
,
min
:
number
,
max
:
number
):
number
;
export
declare
function
nextTick
(
cb
:
(...
args
:
any
[])
=>
void
):
void
;
export
declare
function
addUnit
(
value
?:
string
|
number
):
string
|
undefined
;
export
declare
function
requestAnimationFrame
(
cb
:
()
=>
void
):
NodeJS
.
Timeout
;
export
declare
function
pickExclude
(
obj
:
unknown
,
keys
:
string
[]):
{};
export
declare
function
getRect
(
context
:
WechatMiniprogram
.
Component
.
TrivialInstance
,
selector
:
string
):
Promise
<
WechatMiniprogram
.
BoundingClientRectCallbackResult
>
;
export
declare
function
getAllRect
(
context
:
WechatMiniprogram
.
Component
.
TrivialInstance
,
selector
:
string
):
Promise
<
WechatMiniprogram
.
BoundingClientRectCallbackResult
[]
>
;
export
declare
function
groupSetData
(
context
:
WechatMiniprogram
.
Component
.
TrivialInstance
,
cb
:
()
=>
void
):
void
;
export
declare
function
toPromise
(
promiseLike
:
Promise
<
unknown
>
|
unknown
):
Promise
<
unknown
>
;
export
declare
function
addNumber
(
num1
:
any
,
num2
:
any
):
number
;
export
declare
const
clamp
:
(
num
:
any
,
min
:
any
,
max
:
any
)
=>
number
;
export
declare
function
getCurrentPage
<
T
>
():
T
&
WechatMiniprogram
.
OptionalInterface
<
WechatMiniprogram
.
Page
.
ILifetime
>
&
WechatMiniprogram
.
Page
.
InstanceProperties
&
WechatMiniprogram
.
Page
.
InstanceMethods
<
WechatMiniprogram
.
IAnyObject
>
&
WechatMiniprogram
.
Page
.
Data
<
WechatMiniprogram
.
IAnyObject
>
&
WechatMiniprogram
.
IAnyObject
;
export
declare
const
isPC
:
boolean
;
export
declare
const
isWxWork
:
boolean
;
wxcomponents/vant/common/utils.js
0 → 100644
View file @
8e379ceb
import
{
isDef
,
isNumber
,
isPlainObject
,
isPromise
}
from
'./validator'
;
import
{
canIUseGroupSetData
,
canIUseNextTick
,
getSystemInfoSync
,
}
from
'./version'
;
export
{
isDef
}
from
'./validator'
;
export
{
getSystemInfoSync
}
from
'./version'
;
export
function
range
(
num
,
min
,
max
)
{
return
Math
.
min
(
Math
.
max
(
num
,
min
),
max
);
}
export
function
nextTick
(
cb
)
{
if
(
canIUseNextTick
())
{
wx
.
nextTick
(
cb
);
}
else
{
setTimeout
(()
=>
{
cb
();
},
1000
/
30
);
}
}
export
function
addUnit
(
value
)
{
if
(
!
isDef
(
value
))
{
return
undefined
;
}
value
=
String
(
value
);
return
isNumber
(
value
)
?
`
${
value
}
px`
:
value
;
}
export
function
requestAnimationFrame
(
cb
)
{
return
setTimeout
(()
=>
{
cb
();
},
1000
/
30
);
}
export
function
pickExclude
(
obj
,
keys
)
{
if
(
!
isPlainObject
(
obj
))
{
return
{};
}
return
Object
.
keys
(
obj
).
reduce
((
prev
,
key
)
=>
{
if
(
!
keys
.
includes
(
key
))
{
prev
[
key
]
=
obj
[
key
];
}
return
prev
;
},
{});
}
export
function
getRect
(
context
,
selector
)
{
return
new
Promise
((
resolve
)
=>
{
wx
.
createSelectorQuery
()
.
in
(
context
)
.
select
(
selector
)
.
boundingClientRect
()
.
exec
((
rect
=
[])
=>
resolve
(
rect
[
0
]));
});
}
export
function
getAllRect
(
context
,
selector
)
{
return
new
Promise
((
resolve
)
=>
{
wx
.
createSelectorQuery
()
.
in
(
context
)
.
selectAll
(
selector
)
.
boundingClientRect
()
.
exec
((
rect
=
[])
=>
resolve
(
rect
[
0
]));
});
}
export
function
groupSetData
(
context
,
cb
)
{
if
(
canIUseGroupSetData
())
{
context
.
groupSetData
(
cb
);
}
else
{
cb
();
}
}
export
function
toPromise
(
promiseLike
)
{
if
(
isPromise
(
promiseLike
))
{
return
promiseLike
;
}
return
Promise
.
resolve
(
promiseLike
);
}
// 浮点数精度处理
export
function
addNumber
(
num1
,
num2
)
{
const
cardinal
=
Math
.
pow
(
10
,
10
);
return
Math
.
round
((
num1
+
num2
)
*
cardinal
)
/
cardinal
;
}
// 限制value在[min, max]之间
export
const
clamp
=
(
num
,
min
,
max
)
=>
Math
.
min
(
Math
.
max
(
num
,
min
),
max
);
export
function
getCurrentPage
()
{
const
pages
=
getCurrentPages
();
return
pages
[
pages
.
length
-
1
];
}
export
const
isPC
=
[
'mac'
,
'windows'
].
includes
(
getSystemInfoSync
().
platform
);
// 是否企业微信
export
const
isWxWork
=
getSystemInfoSync
().
environment
===
'wxwork'
;
wxcomponents/vant/common/validator.d.ts
0 → 100644
View file @
8e379ceb
export
declare
function
isFunction
(
val
:
unknown
):
val
is
Function
;
export
declare
function
isPlainObject
(
val
:
unknown
):
val
is
Record
<
string
,
unknown
>
;
export
declare
function
isPromise
<
T
=
unknown
>
(
val
:
unknown
):
val
is
Promise
<
T
>
;
export
declare
function
isDef
(
value
:
unknown
):
boolean
;
export
declare
function
isObj
(
x
:
unknown
):
x
is
Record
<
string
,
unknown
>
;
export
declare
function
isNumber
(
value
:
string
):
boolean
;
export
declare
function
isBoolean
(
value
:
unknown
):
value
is
boolean
;
export
declare
function
isImageUrl
(
url
:
string
):
boolean
;
export
declare
function
isVideoUrl
(
url
:
string
):
boolean
;
wxcomponents/vant/common/validator.js
0 → 100644
View file @
8e379ceb
// eslint-disable-next-line @typescript-eslint/ban-types
export
function
isFunction
(
val
)
{
return
typeof
val
===
'function'
;
}
export
function
isPlainObject
(
val
)
{
return
val
!==
null
&&
typeof
val
===
'object'
&&
!
Array
.
isArray
(
val
);
}
export
function
isPromise
(
val
)
{
return
isPlainObject
(
val
)
&&
isFunction
(
val
.
then
)
&&
isFunction
(
val
.
catch
);
}
export
function
isDef
(
value
)
{
return
value
!==
undefined
&&
value
!==
null
;
}
export
function
isObj
(
x
)
{
const
type
=
typeof
x
;
return
x
!==
null
&&
(
type
===
'object'
||
type
===
'function'
);
}
export
function
isNumber
(
value
)
{
return
/^
\d
+
(\.\d
+
)?
$/
.
test
(
value
);
}
export
function
isBoolean
(
value
)
{
return
typeof
value
===
'boolean'
;
}
const
IMAGE_REGEXP
=
/
\.(
jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg
)
/i
;
const
VIDEO_REGEXP
=
/
\.(
mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv
)
/i
;
export
function
isImageUrl
(
url
)
{
return
IMAGE_REGEXP
.
test
(
url
);
}
export
function
isVideoUrl
(
url
)
{
return
VIDEO_REGEXP
.
test
(
url
);
}
wxcomponents/vant/common/version.d.ts
0 → 100644
View file @
8e379ceb
/// <reference types="miniprogram-api-typings" />
interface
WxWorkSystemInfo
extends
WechatMiniprogram
.
SystemInfo
{
environment
?:
'wxwork'
;
}
interface
SystemInfo
extends
WxWorkSystemInfo
,
WechatMiniprogram
.
SystemInfo
{
}
export
declare
function
getSystemInfoSync
():
SystemInfo
;
export
declare
function
canIUseModel
():
boolean
;
export
declare
function
canIUseFormFieldButton
():
boolean
;
export
declare
function
canIUseAnimate
():
boolean
;
export
declare
function
canIUseGroupSetData
():
boolean
;
export
declare
function
canIUseNextTick
():
boolean
;
export
declare
function
canIUseCanvas2d
():
boolean
;
export
declare
function
canIUseGetUserProfile
():
boolean
;
export
{};
wxcomponents/vant/common/version.js
0 → 100644
View file @
8e379ceb
let
systemInfo
;
export
function
getSystemInfoSync
()
{
if
(
systemInfo
==
null
)
{
systemInfo
=
wx
.
getSystemInfoSync
();
}
return
systemInfo
;
}
function
compareVersion
(
v1
,
v2
)
{
v1
=
v1
.
split
(
'.'
);
v2
=
v2
.
split
(
'.'
);
const
len
=
Math
.
max
(
v1
.
length
,
v2
.
length
);
while
(
v1
.
length
<
len
)
{
v1
.
push
(
'0'
);
}
while
(
v2
.
length
<
len
)
{
v2
.
push
(
'0'
);
}
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
const
num1
=
parseInt
(
v1
[
i
],
10
);
const
num2
=
parseInt
(
v2
[
i
],
10
);
if
(
num1
>
num2
)
{
return
1
;
}
if
(
num1
<
num2
)
{
return
-
1
;
}
}
return
0
;
}
function
gte
(
version
)
{
const
system
=
getSystemInfoSync
();
return
compareVersion
(
system
.
SDKVersion
,
version
)
>=
0
;
}
export
function
canIUseModel
()
{
return
gte
(
'2.9.3'
);
}
export
function
canIUseFormFieldButton
()
{
return
gte
(
'2.10.3'
);
}
export
function
canIUseAnimate
()
{
return
gte
(
'2.9.0'
);
}
export
function
canIUseGroupSetData
()
{
return
gte
(
'2.4.0'
);
}
export
function
canIUseNextTick
()
{
try
{
return
wx
.
canIUse
(
'nextTick'
);
}
catch
(
e
)
{
return
gte
(
'2.7.1'
);
}
}
export
function
canIUseCanvas2d
()
{
return
gte
(
'2.9.0'
);
}
export
function
canIUseGetUserProfile
()
{
return
!!
wx
.
getUserProfile
;
}
wxcomponents/vant/info/index.d.ts
0 → 100644
View file @
8e379ceb
export
{};
wxcomponents/vant/info/index.js
0 → 100644
View file @
8e379ceb
import
{
VantComponent
}
from
'../common/component'
;
VantComponent
({
props
:
{
dot
:
Boolean
,
info
:
null
,
customStyle
:
String
,
},
});
wxcomponents/vant/info/index.json
0 → 100644
View file @
8e379ceb
{
"component"
:
true
}
wxcomponents/vant/info/index.wxml
0 → 100644
View file @
8e379ceb
<wxs src="../wxs/utils.wxs" module="utils" />
<view
wx:if="{{ info !== null && info !== '' || dot }}"
class="van-info {{ utils.bem('info', { dot }) }} custom-class"
style="{{ customStyle }}"
>{{ dot ? '' : info }}</view>
wxcomponents/vant/info/index.wxss
0 → 100644
View file @
8e379ceb
@import '../common/index.wxss';.van-info{align-items:center;background-color:var(--info-background-color,#ee0a24);border:var(--info-border-width,1px) solid #fff;border-radius:var(--info-size,16px);box-sizing:border-box;color:var(--info-color,#fff);display:inline-flex;font-family:var(--info-font-family,-apple-system-font,Helvetica Neue,Arial,sans-serif);font-size:var(--info-font-size,12px);font-weight:var(--info-font-weight,500);height:var(--info-size,16px);justify-content:center;min-width:var(--info-size,16px);padding:var(--info-padding,0 3px);position:absolute;right:0;top:0;transform:translate(50%,-50%);transform-origin:100%;white-space:nowrap}.van-info--dot{background-color:var(--info-dot-color,#ee0a24);border-radius:100%;height:var(--info-dot-size,8px);min-width:0;width:var(--info-dot-size,8px)}
\ No newline at end of file
wxcomponents/vant/mixins/basic.d.ts
0 → 100644
View file @
8e379ceb
export
declare
const
basic
:
string
;
wxcomponents/vant/mixins/basic.js
0 → 100644
View file @
8e379ceb
export
const
basic
=
Behavior
({
methods
:
{
$emit
(
name
,
detail
,
options
)
{
this
.
triggerEvent
(
name
,
detail
,
options
);
},
set
(
data
)
{
this
.
setData
(
data
);
return
new
Promise
((
resolve
)
=>
wx
.
nextTick
(
resolve
));
},
// high performance setData
setView
(
data
,
callback
)
{
const
target
=
{};
let
hasChange
=
false
;
Object
.
keys
(
data
).
forEach
((
key
)
=>
{
if
(
data
[
key
]
!==
this
.
data
[
key
])
{
target
[
key
]
=
data
[
key
];
hasChange
=
true
;
}
});
if
(
hasChange
)
{
return
this
.
setData
(
target
,
callback
);
}
return
callback
&&
callback
();
},
},
});
wxcomponents/vant/mixins/button.d.ts
0 → 100644
View file @
8e379ceb
export
declare
const
button
:
string
;
wxcomponents/vant/mixins/button.js
0 → 100644
View file @
8e379ceb
import
{
canIUseGetUserProfile
}
from
'../common/version'
;
export
const
button
=
Behavior
({
externalClasses
:
[
'hover-class'
],
properties
:
{
id
:
String
,
buttonId
:
String
,
lang
:
String
,
businessId
:
Number
,
sessionFrom
:
String
,
sendMessageTitle
:
String
,
sendMessagePath
:
String
,
sendMessageImg
:
String
,
showMessageCard
:
Boolean
,
appParameter
:
String
,
ariaLabel
:
String
,
openType
:
String
,
getUserProfileDesc
:
String
,
},
data
:
{
canIUseGetUserProfile
:
canIUseGetUserProfile
(),
},
methods
:
{
onGetUserInfo
(
event
)
{
this
.
triggerEvent
(
'getuserinfo'
,
event
.
detail
);
},
onContact
(
event
)
{
this
.
triggerEvent
(
'contact'
,
event
.
detail
);
},
onGetPhoneNumber
(
event
)
{
this
.
triggerEvent
(
'getphonenumber'
,
event
.
detail
);
},
onGetRealTimePhoneNumber
(
event
)
{
this
.
triggerEvent
(
'getrealtimephonenumber'
,
event
.
detail
);
},
onError
(
event
)
{
this
.
triggerEvent
(
'error'
,
event
.
detail
);
},
onLaunchApp
(
event
)
{
this
.
triggerEvent
(
'launchapp'
,
event
.
detail
);
},
onOpenSetting
(
event
)
{
this
.
triggerEvent
(
'opensetting'
,
event
.
detail
);
},
onAgreePrivacyAuthorization
(
event
)
{
this
.
triggerEvent
(
'agreeprivacyauthorization'
,
event
.
detail
);
},
onChooseAvatar
(
event
)
{
this
.
triggerEvent
(
'chooseavatar'
,
event
.
detail
);
},
},
});
wxcomponents/vant/mixins/link.d.ts
0 → 100644
View file @
8e379ceb
export
declare
const
link
:
string
;
wxcomponents/vant/mixins/link.js
0 → 100644
View file @
8e379ceb
export
const
link
=
Behavior
({
properties
:
{
url
:
String
,
linkType
:
{
type
:
String
,
value
:
'navigateTo'
,
},
},
methods
:
{
jumpLink
(
urlKey
=
'url'
)
{
const
url
=
this
.
data
[
urlKey
];
if
(
url
)
{
if
(
this
.
data
.
linkType
===
'navigateTo'
&&
getCurrentPages
().
length
>
9
)
{
wx
.
redirectTo
({
url
});
}
else
{
wx
[
this
.
data
.
linkType
]({
url
});
}
}
},
},
});
wxcomponents/vant/mixins/page-scroll.d.ts
0 → 100644
View file @
8e379ceb
/// <reference types="miniprogram-api-typings" />
/// <reference types="miniprogram-api-typings" />
type
IPageScrollOption
=
WechatMiniprogram
.
Page
.
IPageScrollOption
;
type
Scroller
=
(
this
:
WechatMiniprogram
.
Component
.
TrivialInstance
,
event
?:
IPageScrollOption
)
=>
void
;
export
declare
function
pageScrollMixin
(
scroller
:
Scroller
):
string
;
export
{};
wxcomponents/vant/mixins/page-scroll.js
0 → 100644
View file @
8e379ceb
import
{
isFunction
}
from
'../common/validator'
;
import
{
getCurrentPage
,
isDef
}
from
'../common/utils'
;
function
onPageScroll
(
event
)
{
const
{
vanPageScroller
=
[]
}
=
getCurrentPage
();
vanPageScroller
.
forEach
((
scroller
)
=>
{
if
(
typeof
scroller
===
'function'
)
{
// @ts-ignore
scroller
(
event
);
}
});
}
export
function
pageScrollMixin
(
scroller
)
{
return
Behavior
({
attached
()
{
const
page
=
getCurrentPage
();
if
(
!
isDef
(
page
))
{
return
;
}
const
_scroller
=
scroller
.
bind
(
this
);
const
{
vanPageScroller
=
[]
}
=
page
;
if
(
isFunction
(
page
.
onPageScroll
)
&&
page
.
onPageScroll
!==
onPageScroll
)
{
vanPageScroller
.
push
(
page
.
onPageScroll
.
bind
(
page
));
}
vanPageScroller
.
push
(
_scroller
);
page
.
vanPageScroller
=
vanPageScroller
;
page
.
onPageScroll
=
onPageScroll
;
this
.
_scroller
=
_scroller
;
},
detached
()
{
const
page
=
getCurrentPage
();
if
(
!
isDef
(
page
)
||
!
isDef
(
page
.
vanPageScroller
))
{
return
;
}
const
{
vanPageScroller
}
=
page
;
const
index
=
vanPageScroller
.
findIndex
((
v
)
=>
v
===
this
.
_scroller
);
if
(
index
>
-
1
)
{
page
.
vanPageScroller
.
splice
(
index
,
1
);
}
this
.
_scroller
=
undefined
;
},
});
}
wxcomponents/vant/mixins/touch.d.ts
0 → 100644
View file @
8e379ceb
export
declare
const
touch
:
string
;
wxcomponents/vant/mixins/touch.js
0 → 100644
View file @
8e379ceb
// @ts-nocheck
const
MIN_DISTANCE
=
10
;
function
getDirection
(
x
,
y
)
{
if
(
x
>
y
&&
x
>
MIN_DISTANCE
)
{
return
'horizontal'
;
}
if
(
y
>
x
&&
y
>
MIN_DISTANCE
)
{
return
'vertical'
;
}
return
''
;
}
export
const
touch
=
Behavior
({
methods
:
{
resetTouchStatus
()
{
this
.
direction
=
''
;
this
.
deltaX
=
0
;
this
.
deltaY
=
0
;
this
.
offsetX
=
0
;
this
.
offsetY
=
0
;
},
touchStart
(
event
)
{
this
.
resetTouchStatus
();
const
touch
=
event
.
touches
[
0
];
this
.
startX
=
touch
.
clientX
;
this
.
startY
=
touch
.
clientY
;
},
touchMove
(
event
)
{
const
touch
=
event
.
touches
[
0
];
this
.
deltaX
=
touch
.
clientX
-
this
.
startX
;
this
.
deltaY
=
touch
.
clientY
-
this
.
startY
;
this
.
offsetX
=
Math
.
abs
(
this
.
deltaX
);
this
.
offsetY
=
Math
.
abs
(
this
.
deltaY
);
this
.
direction
=
this
.
direction
||
getDirection
(
this
.
offsetX
,
this
.
offsetY
);
},
},
});
wxcomponents/vant/mixins/transition.d.ts
0 → 100644
View file @
8e379ceb
export
declare
function
transition
(
showDefaultValue
:
boolean
):
string
;
wxcomponents/vant/mixins/transition.js
0 → 100644
View file @
8e379ceb
// @ts-nocheck
import
{
requestAnimationFrame
}
from
'../common/utils'
;
import
{
isObj
}
from
'../common/validator'
;
const
getClassNames
=
(
name
)
=>
({
enter
:
`van-
${
name
}
-enter van-
${
name
}
-enter-active enter-class enter-active-class`
,
'enter-to'
:
`van-
${
name
}
-enter-to van-
${
name
}
-enter-active enter-to-class enter-active-class`
,
leave
:
`van-
${
name
}
-leave van-
${
name
}
-leave-active leave-class leave-active-class`
,
'leave-to'
:
`van-
${
name
}
-leave-to van-
${
name
}
-leave-active leave-to-class leave-active-class`
,
});
export
function
transition
(
showDefaultValue
)
{
return
Behavior
({
properties
:
{
customStyle
:
String
,
// @ts-ignore
show
:
{
type
:
Boolean
,
value
:
showDefaultValue
,
observer
:
'observeShow'
,
},
// @ts-ignore
duration
:
{
type
:
null
,
value
:
300
,
},
name
:
{
type
:
String
,
value
:
'fade'
,
},
},
data
:
{
type
:
''
,
inited
:
false
,
display
:
false
,
},
ready
()
{
if
(
this
.
data
.
show
===
true
)
{
this
.
observeShow
(
true
,
false
);
}
},
methods
:
{
observeShow
(
value
,
old
)
{
if
(
value
===
old
)
{
return
;
}
value
?
this
.
enureEnter
()
:
this
.
enureLeave
();
},
enureEnter
()
{
if
(
this
.
enterPromise
)
return
;
this
.
enterPromise
=
new
Promise
((
resolve
)
=>
this
.
enter
(
resolve
));
},
enureLeave
()
{
const
{
enterPromise
}
=
this
;
if
(
!
enterPromise
)
return
;
enterPromise
.
then
(()
=>
new
Promise
((
resolve
)
=>
this
.
leave
(
resolve
)))
.
then
(()
=>
{
this
.
enterPromise
=
null
;
});
},
enter
(
resolve
)
{
const
{
duration
,
name
}
=
this
.
data
;
const
classNames
=
getClassNames
(
name
);
const
currentDuration
=
isObj
(
duration
)
?
duration
.
enter
:
duration
;
if
(
this
.
status
===
'enter'
)
{
return
;
}
this
.
status
=
'enter'
;
this
.
$emit
(
'before-enter'
);
requestAnimationFrame
(()
=>
{
if
(
this
.
status
!==
'enter'
)
{
return
;
}
this
.
$emit
(
'enter'
);
this
.
setData
({
inited
:
true
,
display
:
true
,
classes
:
classNames
.
enter
,
currentDuration
,
});
requestAnimationFrame
(()
=>
{
if
(
this
.
status
!==
'enter'
)
{
return
;
}
this
.
transitionEnded
=
false
;
this
.
setData
({
classes
:
classNames
[
'enter-to'
]
});
resolve
();
});
});
},
leave
(
resolve
)
{
if
(
!
this
.
data
.
display
)
{
return
;
}
const
{
duration
,
name
}
=
this
.
data
;
const
classNames
=
getClassNames
(
name
);
const
currentDuration
=
isObj
(
duration
)
?
duration
.
leave
:
duration
;
this
.
status
=
'leave'
;
this
.
$emit
(
'before-leave'
);
requestAnimationFrame
(()
=>
{
if
(
this
.
status
!==
'leave'
)
{
return
;
}
this
.
$emit
(
'leave'
);
this
.
setData
({
classes
:
classNames
.
leave
,
currentDuration
,
});
requestAnimationFrame
(()
=>
{
if
(
this
.
status
!==
'leave'
)
{
return
;
}
this
.
transitionEnded
=
false
;
setTimeout
(()
=>
{
this
.
onTransitionEnd
();
resolve
();
},
currentDuration
);
this
.
setData
({
classes
:
classNames
[
'leave-to'
]
});
});
});
},
onTransitionEnd
()
{
if
(
this
.
transitionEnded
)
{
return
;
}
this
.
transitionEnded
=
true
;
this
.
$emit
(
`after-
${
this
.
status
}
`
);
const
{
show
,
display
}
=
this
.
data
;
if
(
!
show
&&
display
)
{
this
.
setData
({
display
:
false
});
}
},
},
});
}
wxcomponents/vant/sticky/index.d.ts
0 → 100644
View file @
8e379ceb
export
{};
wxcomponents/vant/sticky/index.js
0 → 100644
View file @
8e379ceb
import
{
getRect
}
from
'../common/utils'
;
import
{
VantComponent
}
from
'../common/component'
;
import
{
isDef
}
from
'../common/validator'
;
import
{
pageScrollMixin
}
from
'../mixins/page-scroll'
;
const
ROOT_ELEMENT
=
'.van-sticky'
;
VantComponent
({
props
:
{
zIndex
:
{
type
:
Number
,
value
:
99
,
},
offsetTop
:
{
type
:
Number
,
value
:
0
,
observer
:
'onScroll'
,
},
disabled
:
{
type
:
Boolean
,
observer
:
'onScroll'
,
},
container
:
{
type
:
null
,
observer
:
'onScroll'
,
},
scrollTop
:
{
type
:
null
,
observer
(
val
)
{
this
.
onScroll
({
scrollTop
:
val
});
},
},
},
mixins
:
[
pageScrollMixin
(
function
(
event
)
{
if
(
this
.
data
.
scrollTop
!=
null
)
{
return
;
}
this
.
onScroll
(
event
);
}),
],
data
:
{
height
:
0
,
fixed
:
false
,
transform
:
0
,
},
mounted
()
{
this
.
onScroll
();
},
methods
:
{
onScroll
({
scrollTop
}
=
{})
{
const
{
container
,
offsetTop
,
disabled
}
=
this
.
data
;
if
(
disabled
)
{
this
.
setDataAfterDiff
({
fixed
:
false
,
transform
:
0
,
});
return
;
}
this
.
scrollTop
=
scrollTop
||
this
.
scrollTop
;
if
(
typeof
container
===
'function'
)
{
Promise
.
all
([
getRect
(
this
,
ROOT_ELEMENT
),
this
.
getContainerRect
()])
.
then
(([
root
,
container
])
=>
{
if
(
offsetTop
+
root
.
height
>
container
.
height
+
container
.
top
)
{
this
.
setDataAfterDiff
({
fixed
:
false
,
transform
:
container
.
height
-
root
.
height
,
});
}
else
if
(
offsetTop
>=
root
.
top
)
{
this
.
setDataAfterDiff
({
fixed
:
true
,
height
:
root
.
height
,
transform
:
0
,
});
}
else
{
this
.
setDataAfterDiff
({
fixed
:
false
,
transform
:
0
});
}
})
.
catch
(()
=>
{
});
return
;
}
getRect
(
this
,
ROOT_ELEMENT
).
then
((
root
)
=>
{
if
(
!
isDef
(
root
)
||
(
!
root
.
width
&&
!
root
.
height
))
{
return
;
}
if
(
offsetTop
>=
root
.
top
)
{
this
.
setDataAfterDiff
({
fixed
:
true
,
height
:
root
.
height
});
this
.
transform
=
0
;
}
else
{
this
.
setDataAfterDiff
({
fixed
:
false
});
}
});
},
setDataAfterDiff
(
data
)
{
wx
.
nextTick
(()
=>
{
const
diff
=
Object
.
keys
(
data
).
reduce
((
prev
,
key
)
=>
{
if
(
data
[
key
]
!==
this
.
data
[
key
])
{
prev
[
key
]
=
data
[
key
];
}
return
prev
;
},
{});
if
(
Object
.
keys
(
diff
).
length
>
0
)
{
this
.
setData
(
diff
);
}
this
.
$emit
(
'scroll'
,
{
scrollTop
:
this
.
scrollTop
,
isFixed
:
data
.
fixed
||
this
.
data
.
fixed
,
});
});
},
getContainerRect
()
{
const
nodesRef
=
this
.
data
.
container
();
if
(
!
nodesRef
)
{
return
Promise
.
reject
(
new
Error
(
'not found container'
));
}
return
new
Promise
((
resolve
)
=>
nodesRef
.
boundingClientRect
(
resolve
).
exec
());
},
},
});
wxcomponents/vant/sticky/index.json
0 → 100644
View file @
8e379ceb
{
"component"
:
true
}
wxcomponents/vant/sticky/index.wxml
0 → 100644
View file @
8e379ceb
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<view class="custom-class van-sticky" style="{{ computed.containerStyle({ fixed, height, zIndex }) }}">
<view class="{{ utils.bem('sticky-wrap', { fixed }) }}" style="{{ computed.wrapStyle({ fixed, offsetTop, transform, zIndex }) }}">
<slot />
</view>
</view>
wxcomponents/vant/sticky/index.wxs
0 → 100644
View file @
8e379ceb
/* eslint-disable */
var style = require('../wxs/style.wxs');
var addUnit = require('../wxs/add-unit.wxs');
function wrapStyle(data) {
return style({
transform: data.transform
? 'translate3d(0, ' + data.transform + 'px, 0)'
: '',
top: data.fixed ? addUnit(data.offsetTop) : '',
'z-index': data.zIndex,
});
}
function containerStyle(data) {
return style({
height: data.fixed ? addUnit(data.height) : '',
'z-index': data.zIndex,
});
}
module.exports = {
wrapStyle: wrapStyle,
containerStyle: containerStyle,
};
wxcomponents/vant/sticky/index.wxss
0 → 100644
View file @
8e379ceb
@import '../common/index.wxss';.van-sticky{position:relative}.van-sticky-wrap--fixed{left:0;position:fixed;right:0}
\ No newline at end of file
wxcomponents/vant/tab/index.d.ts
0 → 100644
View file @
8e379ceb
export
{};
wxcomponents/vant/tab/index.js
0 → 100644
View file @
8e379ceb
import
{
useParent
}
from
'../common/relation'
;
import
{
VantComponent
}
from
'../common/component'
;
VantComponent
({
relation
:
useParent
(
'tabs'
),
props
:
{
dot
:
{
type
:
Boolean
,
observer
:
'update'
,
},
info
:
{
type
:
null
,
observer
:
'update'
,
},
title
:
{
type
:
String
,
observer
:
'update'
,
},
disabled
:
{
type
:
Boolean
,
observer
:
'update'
,
},
titleStyle
:
{
type
:
String
,
observer
:
'update'
,
},
name
:
{
type
:
null
,
value
:
''
,
},
},
data
:
{
active
:
false
,
},
methods
:
{
getComputedName
()
{
if
(
this
.
data
.
name
!==
''
)
{
return
this
.
data
.
name
;
}
return
this
.
index
;
},
updateRender
(
active
,
parent
)
{
const
{
data
:
parentData
}
=
parent
;
this
.
inited
=
this
.
inited
||
active
;
this
.
setData
({
active
,
shouldRender
:
this
.
inited
||
!
parentData
.
lazyRender
,
shouldShow
:
active
||
parentData
.
animated
,
});
},
update
()
{
if
(
this
.
parent
)
{
this
.
parent
.
updateTabs
();
}
},
},
});
wxcomponents/vant/tab/index.json
0 → 100644
View file @
8e379ceb
{
"component"
:
true
}
wxcomponents/vant/tab/index.wxml
0 → 100644
View file @
8e379ceb
<wxs src="../wxs/utils.wxs" module="utils" />
<view
class="custom-class {{ utils.bem('tab__pane', { active, inactive: !active }) }}"
style="{{ shouldShow ? '' : 'display: none;' }}"
>
<slot wx:if="{{ shouldRender }}" />
</view>
wxcomponents/vant/tab/index.wxss
0 → 100644
View file @
8e379ceb
@import '../common/index.wxss';:host{box-sizing:border-box;flex-shrink:0;width:100%}.van-tab__pane{-webkit-overflow-scrolling:touch;box-sizing:border-box;overflow-y:auto}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible}
\ No newline at end of file
wxcomponents/vant/tabs/index.d.ts
0 → 100644
View file @
8e379ceb
export
{};
wxcomponents/vant/tabs/index.js
0 → 100644
View file @
8e379ceb
import
{
VantComponent
}
from
'../common/component'
;
import
{
touch
}
from
'../mixins/touch'
;
import
{
getAllRect
,
getRect
,
groupSetData
,
nextTick
,
requestAnimationFrame
,
}
from
'../common/utils'
;
import
{
isDef
}
from
'../common/validator'
;
import
{
useChildren
}
from
'../common/relation'
;
VantComponent
({
mixins
:
[
touch
],
classes
:
[
'nav-class'
,
'tab-class'
,
'tab-active-class'
,
'line-class'
,
'wrap-class'
,
],
relation
:
useChildren
(
'tab'
,
function
()
{
this
.
updateTabs
();
}),
props
:
{
sticky
:
Boolean
,
border
:
Boolean
,
swipeable
:
Boolean
,
titleActiveColor
:
String
,
titleInactiveColor
:
String
,
color
:
String
,
animated
:
{
type
:
Boolean
,
observer
()
{
this
.
children
.
forEach
((
child
,
index
)
=>
child
.
updateRender
(
index
===
this
.
data
.
currentIndex
,
this
));
},
},
lineWidth
:
{
type
:
null
,
value
:
40
,
observer
:
'resize'
,
},
lineHeight
:
{
type
:
null
,
value
:
-
1
,
},
active
:
{
type
:
null
,
value
:
0
,
observer
(
name
)
{
if
(
name
!==
this
.
getCurrentName
())
{
this
.
setCurrentIndexByName
(
name
);
}
},
},
type
:
{
type
:
String
,
value
:
'line'
,
},
ellipsis
:
{
type
:
Boolean
,
value
:
true
,
},
duration
:
{
type
:
Number
,
value
:
0.3
,
},
zIndex
:
{
type
:
Number
,
value
:
1
,
},
swipeThreshold
:
{
type
:
Number
,
value
:
5
,
observer
(
value
)
{
this
.
setData
({
scrollable
:
this
.
children
.
length
>
value
||
!
this
.
data
.
ellipsis
,
});
},
},
offsetTop
:
{
type
:
Number
,
value
:
0
,
},
lazyRender
:
{
type
:
Boolean
,
value
:
true
,
},
useBeforeChange
:
{
type
:
Boolean
,
value
:
false
,
},
},
data
:
{
tabs
:
[],
scrollLeft
:
0
,
scrollable
:
false
,
currentIndex
:
0
,
container
:
null
,
skipTransition
:
true
,
scrollWithAnimation
:
false
,
lineOffsetLeft
:
0
,
inited
:
false
,
},
mounted
()
{
requestAnimationFrame
(()
=>
{
this
.
swiping
=
true
;
this
.
setData
({
container
:
()
=>
this
.
createSelectorQuery
().
select
(
'.van-tabs'
),
});
this
.
resize
();
this
.
scrollIntoView
();
});
},
methods
:
{
updateTabs
()
{
const
{
children
=
[],
data
}
=
this
;
this
.
setData
({
tabs
:
children
.
map
((
child
)
=>
child
.
data
),
scrollable
:
this
.
children
.
length
>
data
.
swipeThreshold
||
!
data
.
ellipsis
,
});
this
.
setCurrentIndexByName
(
data
.
active
||
this
.
getCurrentName
());
},
trigger
(
eventName
,
child
)
{
const
{
currentIndex
}
=
this
.
data
;
const
data
=
this
.
getChildData
(
currentIndex
,
child
);
if
(
!
isDef
(
data
))
{
return
;
}
this
.
$emit
(
eventName
,
data
);
},
onTap
(
event
)
{
const
{
index
}
=
event
.
currentTarget
.
dataset
;
const
child
=
this
.
children
[
index
];
if
(
child
.
data
.
disabled
)
{
this
.
trigger
(
'disabled'
,
child
);
return
;
}
this
.
onBeforeChange
(
index
).
then
(()
=>
{
this
.
setCurrentIndex
(
index
);
nextTick
(()
=>
{
this
.
trigger
(
'click'
);
});
});
},
// correct the index of active tab
setCurrentIndexByName
(
name
)
{
const
{
children
=
[]
}
=
this
;
const
matched
=
children
.
filter
((
child
)
=>
child
.
getComputedName
()
===
name
);
if
(
matched
.
length
)
{
this
.
setCurrentIndex
(
matched
[
0
].
index
);
}
},
setCurrentIndex
(
currentIndex
)
{
const
{
data
,
children
=
[]
}
=
this
;
if
(
!
isDef
(
currentIndex
)
||
currentIndex
>=
children
.
length
||
currentIndex
<
0
)
{
return
;
}
groupSetData
(
this
,
()
=>
{
children
.
forEach
((
item
,
index
)
=>
{
const
active
=
index
===
currentIndex
;
if
(
active
!==
item
.
data
.
active
||
!
item
.
inited
)
{
item
.
updateRender
(
active
,
this
);
}
});
});
if
(
currentIndex
===
data
.
currentIndex
)
{
if
(
!
data
.
inited
)
{
this
.
resize
();
}
return
;
}
const
shouldEmitChange
=
data
.
currentIndex
!==
null
;
this
.
setData
({
currentIndex
});
requestAnimationFrame
(()
=>
{
this
.
resize
();
this
.
scrollIntoView
();
});
nextTick
(()
=>
{
this
.
trigger
(
'input'
);
if
(
shouldEmitChange
)
{
this
.
trigger
(
'change'
);
}
});
},
getCurrentName
()
{
const
activeTab
=
this
.
children
[
this
.
data
.
currentIndex
];
if
(
activeTab
)
{
return
activeTab
.
getComputedName
();
}
},
resize
()
{
if
(
this
.
data
.
type
!==
'line'
)
{
return
;
}
const
{
currentIndex
,
ellipsis
,
skipTransition
}
=
this
.
data
;
Promise
.
all
([
getAllRect
(
this
,
'.van-tab'
),
getRect
(
this
,
'.van-tabs__line'
),
]).
then
(([
rects
=
[],
lineRect
])
=>
{
const
rect
=
rects
[
currentIndex
];
if
(
rect
==
null
)
{
return
;
}
let
lineOffsetLeft
=
rects
.
slice
(
0
,
currentIndex
)
.
reduce
((
prev
,
curr
)
=>
prev
+
curr
.
width
,
0
);
lineOffsetLeft
+=
(
rect
.
width
-
lineRect
.
width
)
/
2
+
(
ellipsis
?
0
:
8
);
this
.
setData
({
lineOffsetLeft
,
inited
:
true
});
this
.
swiping
=
true
;
if
(
skipTransition
)
{
// waiting transition end
setTimeout
(()
=>
{
this
.
setData
({
skipTransition
:
false
});
},
this
.
data
.
duration
);
}
});
},
// scroll active tab into view
scrollIntoView
()
{
const
{
currentIndex
,
scrollable
,
scrollWithAnimation
}
=
this
.
data
;
if
(
!
scrollable
)
{
return
;
}
Promise
.
all
([
getAllRect
(
this
,
'.van-tab'
),
getRect
(
this
,
'.van-tabs__nav'
),
]).
then
(([
tabRects
,
navRect
])
=>
{
const
tabRect
=
tabRects
[
currentIndex
];
const
offsetLeft
=
tabRects
.
slice
(
0
,
currentIndex
)
.
reduce
((
prev
,
curr
)
=>
prev
+
curr
.
width
,
0
);
this
.
setData
({
scrollLeft
:
offsetLeft
-
(
navRect
.
width
-
tabRect
.
width
)
/
2
,
});
if
(
!
scrollWithAnimation
)
{
nextTick
(()
=>
{
this
.
setData
({
scrollWithAnimation
:
true
});
});
}
});
},
onTouchScroll
(
event
)
{
this
.
$emit
(
'scroll'
,
event
.
detail
);
},
onTouchStart
(
event
)
{
if
(
!
this
.
data
.
swipeable
)
return
;
this
.
swiping
=
true
;
this
.
touchStart
(
event
);
},
onTouchMove
(
event
)
{
if
(
!
this
.
data
.
swipeable
||
!
this
.
swiping
)
return
;
this
.
touchMove
(
event
);
},
// watch swipe touch end
onTouchEnd
()
{
if
(
!
this
.
data
.
swipeable
||
!
this
.
swiping
)
return
;
const
{
direction
,
deltaX
,
offsetX
}
=
this
;
const
minSwipeDistance
=
50
;
if
(
direction
===
'horizontal'
&&
offsetX
>=
minSwipeDistance
)
{
const
index
=
this
.
getAvaiableTab
(
deltaX
);
if
(
index
!==
-
1
)
{
this
.
onBeforeChange
(
index
).
then
(()
=>
this
.
setCurrentIndex
(
index
));
}
}
this
.
swiping
=
false
;
},
getAvaiableTab
(
direction
)
{
const
{
tabs
,
currentIndex
}
=
this
.
data
;
const
step
=
direction
>
0
?
-
1
:
1
;
for
(
let
i
=
step
;
currentIndex
+
i
<
tabs
.
length
&&
currentIndex
+
i
>=
0
;
i
+=
step
)
{
const
index
=
currentIndex
+
i
;
if
(
index
>=
0
&&
index
<
tabs
.
length
&&
tabs
[
index
]
&&
!
tabs
[
index
].
disabled
)
{
return
index
;
}
}
return
-
1
;
},
onBeforeChange
(
index
)
{
const
{
useBeforeChange
}
=
this
.
data
;
if
(
!
useBeforeChange
)
{
return
Promise
.
resolve
();
}
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
$emit
(
'before-change'
,
Object
.
assign
(
Object
.
assign
({},
this
.
getChildData
(
index
)),
{
callback
:
(
status
)
=>
(
status
?
resolve
()
:
reject
())
}));
});
},
getChildData
(
index
,
child
)
{
const
currentChild
=
child
||
this
.
children
[
index
];
if
(
!
isDef
(
currentChild
))
{
return
;
}
return
{
index
:
currentChild
.
index
,
name
:
currentChild
.
getComputedName
(),
title
:
currentChild
.
data
.
title
,
};
},
},
});
wxcomponents/vant/tabs/index.json
0 → 100644
View file @
8e379ceb
{
"component"
:
true
,
"usingComponents"
:
{
"van-info"
:
"../info/index"
,
"van-sticky"
:
"../sticky/index"
}
}
wxcomponents/vant/tabs/index.wxml
0 → 100644
View file @
8e379ceb
<wxs src="../wxs/utils.wxs" module="utils" />
<wxs src="./index.wxs" module="computed" />
<view class="custom-class {{ utils.bem('tabs') }}">
<van-sticky
disabled="{{ !sticky }}"
z-index="{{ zIndex }}"
offset-top="{{ offsetTop }}"
container="{{ container }}"
bind:scroll="onTouchScroll"
>
<view class="{{ utils.bem('tabs--') + type }} {{ utils.bem('tabs__wrap', { scrollable }) }} {{ type === 'line' && border ? 'van-hairline--top-bottom' : '' }} wrap-class">
<slot name="nav-left" />
<scroll-view
scroll-x="{{ scrollable }}"
scroll-with-animation="{{ scrollWithAnimation }}"
scroll-left="{{ scrollLeft }}"
class="{{ utils.bem('tabs__scroll', [type]) }}"
style="{{ color ? 'border-color: ' + color : '' }}"
>
<view class="{{ utils.bem('tabs__nav', [type, { complete: !ellipsis }]) }} nav-class" style="{{ computed.navStyle(color, type) }}">
<view wx:if="{{ type === 'line' }}" class="van-tabs__line" style="{{ computed.lineStyle({ color, lineOffsetLeft, lineHeight, skipTransition, duration, lineWidth, inited }) }}" />
<view
wx:for="{{ tabs }}"
wx:key="index"
data-index="{{ index }}"
class="{{ computed.tabClass(index === currentIndex, ellipsis) }} {{ utils.bem('tab', { active: index === currentIndex, disabled: item.disabled, complete: !ellipsis }) }}"
style="{{ computed.tabStyle({ active: index === currentIndex, ellipsis, color, type, disabled: item.disabled, titleActiveColor, titleInactiveColor, swipeThreshold, scrollable }) }}"
bind:tap="onTap"
>
<view class="{{ ellipsis ? 'van-ellipsis' : '' }}" style="{{ item.titleStyle }}">
{{ item.title }}
<van-info
wx:if="{{ item.info !== null || item.dot }}"
info="{{ item.info }}"
dot="{{ item.dot }}"
custom-class="van-tab__title__info"
/>
</view>
</view>
</view>
</scroll-view>
<slot name="nav-right" />
</view>
</van-sticky>
<view
class="van-tabs__content"
bind:touchstart="onTouchStart"
bind:touchmove="onTouchMove"
bind:touchend="onTouchEnd"
bind:touchcancel="onTouchEnd"
>
<view
class="{{ utils.bem('tabs__track', [{ animated }]) }} van-tabs__track"
style="{{ computed.trackStyle({ duration, currentIndex, animated }) }}"
>
<slot />
</view>
</view>
</view>
wxcomponents/vant/tabs/index.wxs
0 → 100644
View file @
8e379ceb
/* eslint-disable */
var utils = require('../wxs/utils.wxs');
var style = require('../wxs/style.wxs');
function tabClass(active, ellipsis) {
var classes = ['tab-class'];
if (active) {
classes.push('tab-active-class');
}
if (ellipsis) {
classes.push('van-ellipsis');
}
return classes.join(' ');
}
function tabStyle(data) {
var titleColor = data.active
? data.titleActiveColor
: data.titleInactiveColor;
var ellipsis = data.scrollable && data.ellipsis;
// card theme color
if (data.type === 'card') {
return style({
'border-color': data.color,
'background-color': !data.disabled && data.active ? data.color : null,
color: titleColor || (!data.disabled && !data.active ? data.color : null),
'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null,
});
}
return style({
color: titleColor,
'flex-basis': ellipsis ? 88 / data.swipeThreshold + '%' : null,
});
}
function navStyle(color, type) {
return style({
'border-color': type === 'card' && color ? color : null,
});
}
function trackStyle(data) {
if (!data.animated) {
return '';
}
return style({
left: -100 * data.currentIndex + '%',
'transition-duration': data.duration + 's',
'-webkit-transition-duration': data.duration + 's',
});
}
function lineStyle(data) {
return style({
width: utils.addUnit(data.lineWidth),
opacity: data.inited ? 1 : 0,
transform: 'translateX(' + data.lineOffsetLeft + 'px)',
'-webkit-transform': 'translateX(' + data.lineOffsetLeft + 'px)',
'background-color': data.color,
height: data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null,
'border-radius':
data.lineHeight !== -1 ? utils.addUnit(data.lineHeight) : null,
'transition-duration': !data.skipTransition ? data.duration + 's' : null,
'-webkit-transition-duration': !data.skipTransition
? data.duration + 's'
: null,
});
}
module.exports = {
tabClass: tabClass,
tabStyle: tabStyle,
trackStyle: trackStyle,
lineStyle: lineStyle,
navStyle: navStyle,
};
wxcomponents/vant/tabs/index.wxss
0 → 100644
View file @
8e379ceb
@import '../common/index.wxss';.van-tabs{-webkit-tap-highlight-color:transparent;position:relative}.van-tabs__wrap{display:flex;overflow:hidden}.van-tabs__wrap--scrollable .van-tab{flex:0 0 22%}.van-tabs__wrap--scrollable .van-tab--complete{flex:1 0 auto!important;padding:0 12px}.van-tabs__wrap--scrollable .van-tabs__nav--complete{padding-left:8px;padding-right:8px}.van-tabs__scroll{background-color:var(--tabs-nav-background-color,#fff);overflow:auto}.van-tabs__scroll--line{box-sizing:initial;height:calc(100% + 15px)}.van-tabs__scroll--card{border:1px solid var(--tabs-default-color,#ee0a24);border-radius:2px;box-sizing:border-box;margin:0 var(--padding-md,16px);width:calc(100% - var(--padding-md, 16px)*2)}.van-tabs__scroll::-webkit-scrollbar{display:none}.van-tabs__nav{display:flex;position:relative;-webkit-user-select:none;user-select:none}.van-tabs__nav--card{box-sizing:border-box;height:var(--tabs-card-height,30px)}.van-tabs__nav--card .van-tab{border-right:1px solid var(--tabs-default-color,#ee0a24);color:var(--tabs-default-color,#ee0a24);line-height:calc(var(--tabs-card-height, 30px) - 2px)}.van-tabs__nav--card .van-tab:last-child{border-right:none}.van-tabs__nav--card .van-tab.van-tab--active{background-color:var(--tabs-default-color,#ee0a24);color:#fff}.van-tabs__nav--card .van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tabs__line{background-color:var(--tabs-bottom-bar-color,#ee0a24);border-radius:var(--tabs-bottom-bar-height,3px);bottom:0;height:var(--tabs-bottom-bar-height,3px);left:0;opacity:0;position:absolute;z-index:1}.van-tabs__track{height:100%;position:relative;width:100%}.van-tabs__track--animated{display:flex;transition-property:left}.van-tabs__content{overflow:hidden}.van-tabs--line{height:var(--tabs-line-height,44px)}.van-tabs--card{height:var(--tabs-card-height,30px)}.van-tab{background-color:#f6f8fa; box-sizing:border-box;color:var(--tab-text-color,#646566);cursor:pointer;flex:1;font-size:var(--tab-font-size,14px);line-height:var(--tabs-line-height,44px);min-width:0;padding:0 5px;position:relative;text-align:center}.van-tab--active{color:var(--tab-active-text-color,#323233);font-weight:var(--font-weight-bold,500)}.van-tab--disabled{color:var(--tab-disabled-text-color,#c8c9cc)}.van-tab__title__info{position:relative!important;top:-1px!important;transform:translateX(0)!important}
\ No newline at end of file
wxcomponents/vant/wxs/add-unit.wxs
0 → 100644
View file @
8e379ceb
/* eslint-disable */
var REGEXP = getRegExp('^-?\d+(\.\d+)?$');
function addUnit(value) {
if (value == null) {
return undefined;
}
return REGEXP.test('' + value) ? value + 'px' : value;
}
module.exports = addUnit;
wxcomponents/vant/wxs/array.wxs
0 → 100644
View file @
8e379ceb
function isArray(array) {
return array && array.constructor === 'Array';
}
module.exports.isArray = isArray;
wxcomponents/vant/wxs/bem.wxs
0 → 100644
View file @
8e379ceb
/* eslint-disable */
var array = require('./array.wxs');
var object = require('./object.wxs');
var PREFIX = 'van-';
function join(name, mods) {
name = PREFIX + name;
mods = mods.map(function(mod) {
return name + '--' + mod;
});
mods.unshift(name);
return mods.join(' ');
}
function traversing(mods, conf) {
if (!conf) {
return;
}
if (typeof conf === 'string' || typeof conf === 'number') {
mods.push(conf);
} else if (array.isArray(conf)) {
conf.forEach(function(item) {
traversing(mods, item);
});
} else if (typeof conf === 'object') {
object.keys(conf).forEach(function(key) {
conf[key] && mods.push(key);
});
}
}
function bem(name, conf) {
var mods = [];
traversing(mods, conf);
return join(name, mods);
}
module.exports = bem;
wxcomponents/vant/wxs/memoize.wxs
0 → 100644
View file @
8e379ceb
/**
* Simple memoize
* wxs doesn't support fn.apply, so this memoize only support up to 2 args
*/
/* eslint-disable */
function isPrimitive(value) {
var type = typeof value;
return (
type === 'boolean' ||
type === 'number' ||
type === 'string' ||
type === 'undefined' ||
value === null
);
}
// mock simple fn.call in wxs
function call(fn, args) {
if (args.length === 2) {
return fn(args[0], args[1]);
}
if (args.length === 1) {
return fn(args[0]);
}
return fn();
}
function serializer(args) {
if (args.length === 1 && isPrimitive(args[0])) {
return args[0];
}
var obj = {};
for (var i = 0; i < args.length; i++) {
obj['key' + i] = args[i];
}
return JSON.stringify(obj);
}
function memoize(fn) {
var cache = {};
return function() {
var key = serializer(arguments);
if (cache[key] === undefined) {
cache[key] = call(fn, arguments);
}
return cache[key];
};
}
module.exports = memoize;
wxcomponents/vant/wxs/object.wxs
0 → 100644
View file @
8e379ceb
/* eslint-disable */
var REGEXP = getRegExp('{|}|"', 'g');
function keys(obj) {
return JSON.stringify(obj)
.replace(REGEXP, '')
.split(',')
.map(function(item) {
return item.split(':')[0];
});
}
module.exports.keys = keys;
wxcomponents/vant/wxs/style.wxs
0 → 100644
View file @
8e379ceb
/* eslint-disable */
var object = require('./object.wxs');
var array = require('./array.wxs');
function kebabCase(word) {
var newWord = word
.replace(getRegExp("[A-Z]", 'g'), function (i) {
return '-' + i;
})
.toLowerCase()
return newWord;
}
function style(styles) {
if (array.isArray(styles)) {
return styles
.filter(function (item) {
return item != null && item !== '';
})
.map(function (item) {
return style(item);
})
.join(';');
}
if ('Object' === styles.constructor) {
return object
.keys(styles)
.filter(function (key) {
return styles[key] != null && styles[key] !== '';
})
.map(function (key) {
return [kebabCase(key), [styles[key]]].join(':');
})
.join(';');
}
return styles;
}
module.exports = style;
wxcomponents/vant/wxs/utils.wxs
0 → 100644
View file @
8e379ceb
/* eslint-disable */
var bem = require('./bem.wxs');
var memoize = require('./memoize.wxs');
var addUnit = require('./add-unit.wxs');
module.exports = {
bem: memoize(bem),
memoize: memoize,
addUnit: addUnit
};
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