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
"jetbrains:/idea/checkout/git" did not exist on "a71243d9eba30bca63aff56f02f3fc8601fe8495"
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/action-sheet/index.d.ts
0 → 100644
View file @
b1af78f9
export
{};
litemall-wx/lib/vant-weapp/action-sheet/index.js
0 → 100644
View file @
b1af78f9
import
{
VantComponent
}
from
'
../common/component
'
;
VantComponent
({
props
:
{
show
:
Boolean
,
title
:
String
,
cancelText
:
String
,
description
:
String
,
round
:
{
type
:
Boolean
,
value
:
true
},
zIndex
:
{
type
:
Number
,
value
:
100
},
actions
:
{
type
:
Array
,
value
:
[]
},
overlay
:
{
type
:
Boolean
,
value
:
true
},
closeOnClickOverlay
:
{
type
:
Boolean
,
value
:
true
},
closeOnClickAction
:
{
type
:
Boolean
,
value
:
true
},
safeAreaInsetBottom
:
{
type
:
Boolean
,
value
:
true
}
},
methods
:
{
onSelect
(
event
)
{
const
{
index
}
=
event
.
currentTarget
.
dataset
;
const
item
=
this
.
data
.
actions
[
index
];
if
(
item
&&
!
item
.
disabled
&&
!
item
.
loading
)
{
this
.
$emit
(
'
select
'
,
item
);
if
(
this
.
data
.
closeOnClickAction
)
{
this
.
onClose
();
}
}
},
onCancel
()
{
this
.
$emit
(
'
cancel
'
);
},
onClose
()
{
this
.
$emit
(
'
close
'
);
},
onClickOverlay
()
{
this
.
$emit
(
'
click-overlay
'
);
this
.
onClose
();
}
}
});
litemall-wx/lib/vant-weapp/action-sheet/index.json
0 → 100644
View file @
b1af78f9
{
"component"
:
true
,
"usingComponents"
:
{
"van-icon"
:
"../icon/index"
,
"van-popup"
:
"../popup/index"
,
"van-loading"
:
"../loading/index"
}
}
litemall-wx/lib/vant-weapp/action-sheet/index.wxml
0 → 100644
View file @
b1af78f9
<wxs src="../wxs/utils.wxs" module="utils" />
<van-popup
show="{{ show }}"
position="bottom"
round="{{ round }}"
z-index="{{ zIndex }}"
overlay="{{ overlay }}"
custom-class="van-action-sheet"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
bind:close="onClickOverlay"
>
<view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header">
{{ title }}
<van-icon
name="close"
custom-class="van-action-sheet__close"
bind:click="onClose"
/>
</view>
<view wx:if="{{ description }}" class="van-action-sheet__description">
{{ description }}
</view>
<view wx:if="{{ actions && actions.length }}">
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
<button
wx:for="{{ actions }}"
wx:key="index"
open-type="{{ item.openType }}"
style="{{ item.color ? 'color: ' + item.color : '' }}"
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
hover-class="van-action-sheet__item--hover"
data-index="{{ index }}"
bind:tap="onSelect"
>
<block wx:if="{{ !item.loading }}">
{{ item.name }}
<text wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</text>
</block>
<van-loading wx:else custom-class="van-action-sheet__loading" size="20px" />
</button>
</view>
<slot />
<view
wx:if="{{ cancelText }}"
class="van-action-sheet__cancel"
hover-class="van-action-sheet__cancel--hover"
hover-stay-time="70"
bind:tap="onCancel"
>
{{ cancelText }}
</view>
</van-popup>
litemall-wx/lib/vant-weapp/action-sheet/index.wxss
0 → 100644
View file @
b1af78f9
@import '../common/index.wxss';.van-action-sheet{max-height:90%!important;max-height:var(--action-sheet-max-height,90%)!important;color:#323233;color:var(--action-sheet-item-text-color,#323233)}.van-action-sheet__cancel,.van-action-sheet__item{text-align:center;font-size:16px;font-size:var(--action-sheet-item-font-size,16px);line-height:50px;line-height:var(--action-sheet-item-height,50px);background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__cancel--hover,.van-action-sheet__item--hover{background-color:#f2f3f5;background-color:var(--active-color,#f2f3f5)}.van-action-sheet__cancel:before{display:block;content:" ";height:8px;height:var(--action-sheet-cancel-padding-top,8px);background-color:#f7f8fa;background-color:var(--action-sheet-cancel-padding-color,#f7f8fa)}.van-action-sheet__item--disabled{color:#c8c9cc;color:var(--action-sheet-item-disabled-text-color,#c8c9cc)}.van-action-sheet__item--disabled.van-action-sheet__item--hover{background-color:#fff;background-color:var(--action-sheet-item-background,#fff)}.van-action-sheet__subname{margin-left:4px;margin-left:var(--padding-base,4px);font-size:12px;font-size:var(--action-sheet-subname-font-size,12px);color:#646566;color:var(--action-sheet-subname-color,#646566)}.van-action-sheet__header{text-align:center;font-weight:500;font-weight:var(--font-weight-bold,500);font-size:16px;font-size:var(--action-sheet-header-font-size,16px);line-height:44px;line-height:var(--action-sheet-header-height,44px)}.van-action-sheet__description{text-align:center;padding:16px;padding:var(--padding-md,16px);color:#646566;color:var(--action-sheet-description-color,#646566);font-size:14px;font-size:var(--action-sheet-description-font-size,14px);line-height:20px;line-height:var(--action-sheet-description-line-height,20px)}.van-action-sheet__close{position:absolute!important;top:0;right:0;line-height:inherit!important;padding:0 12px;padding:var(--action-sheet-close-icon-padding,0 12px);font-size:18px!important;font-size:var(--action-sheet-close-icon-size,18px)!important;color:#969799;color:var(--action-sheet-close-icon-color,#969799)}.van-action-sheet__loading{display:-webkit-flex!important;display:flex!important;height:50px;height:var(--action-sheet-item-height,50px)}
\ No newline at end of file
litemall-wx/lib/vant-weapp/area/index.d.ts
0 → 100644
View file @
b1af78f9
export
{};
litemall-wx/lib/vant-weapp/area/index.js
0 → 100644
View file @
b1af78f9
import
{
VantComponent
}
from
'
../common/component
'
;
import
{
pickerProps
}
from
'
../picker/shared
'
;
const
COLUMNSPLACEHOLDERCODE
=
'
000000
'
;
VantComponent
({
classes
:
[
'
active-class
'
,
'
toolbar-class
'
,
'
column-class
'
],
props
:
Object
.
assign
(
Object
.
assign
({},
pickerProps
),
{
value
:
String
,
areaList
:
{
type
:
Object
,
value
:
{}
},
columnsNum
:
{
type
:
null
,
value
:
3
},
columnsPlaceholder
:
{
type
:
Array
,
observer
(
val
)
{
this
.
setData
({
typeToColumnsPlaceholder
:
{
province
:
val
[
0
]
||
''
,
city
:
val
[
1
]
||
''
,
county
:
val
[
2
]
||
''
,
}
});
}
}
}),
data
:
{
columns
:
[{
values
:
[]
},
{
values
:
[]
},
{
values
:
[]
}],
displayColumns
:
[{
values
:
[]
},
{
values
:
[]
},
{
values
:
[]
}],
typeToColumnsPlaceholder
:
{}
},
watch
:
{
value
(
value
)
{
this
.
code
=
value
;
this
.
setValues
();
},
areaList
:
'
setValues
'
,
columnsNum
(
value
)
{
this
.
setData
({
displayColumns
:
this
.
data
.
columns
.
slice
(
0
,
+
value
)
});
}
},
mounted
()
{
setTimeout
(()
=>
{
this
.
setValues
();
},
0
);
},
methods
:
{
getPicker
()
{
if
(
this
.
picker
==
null
)
{
this
.
picker
=
this
.
selectComponent
(
'
.van-area__picker
'
);
}
return
this
.
picker
;
},
onCancel
(
event
)
{
this
.
emit
(
'
cancel
'
,
event
.
detail
);
},
onConfirm
(
event
)
{
const
{
index
}
=
event
.
detail
;
let
{
value
}
=
event
.
detail
;
value
=
this
.
parseOutputValues
(
value
);
this
.
emit
(
'
confirm
'
,
{
value
,
index
});
},
emit
(
type
,
detail
)
{
detail
.
values
=
detail
.
value
;
delete
detail
.
value
;
this
.
$emit
(
type
,
detail
);
},
// parse output columns data
parseOutputValues
(
values
)
{
const
{
columnsPlaceholder
}
=
this
.
data
;
return
values
.
map
((
value
,
index
)
=>
{
// save undefined value
if
(
!
value
)
return
value
;
value
=
JSON
.
parse
(
JSON
.
stringify
(
value
));
if
(
!
value
.
code
||
value
.
name
===
columnsPlaceholder
[
index
])
{
value
.
code
=
''
;
value
.
name
=
''
;
}
return
value
;
});
},
onChange
(
event
)
{
const
{
index
,
picker
,
value
}
=
event
.
detail
;
this
.
code
=
value
[
index
].
code
;
this
.
setValues
().
then
(()
=>
{
this
.
$emit
(
'
change
'
,
{
picker
,
values
:
this
.
parseOutputValues
(
picker
.
getValues
()),
index
});
});
},
getConfig
(
type
)
{
const
{
areaList
}
=
this
.
data
;
return
(
areaList
&&
areaList
[
`
${
type
}
_list`
])
||
{};
},
getList
(
type
,
code
)
{
const
{
typeToColumnsPlaceholder
}
=
this
.
data
;
let
result
=
[];
if
(
type
!==
'
province
'
&&
!
code
)
{
return
result
;
}
const
list
=
this
.
getConfig
(
type
);
result
=
Object
.
keys
(
list
).
map
(
code
=>
({
code
,
name
:
list
[
code
]
}));
if
(
code
)
{
// oversea code
if
(
code
[
0
]
===
'
9
'
&&
type
===
'
city
'
)
{
code
=
'
9
'
;
}
result
=
result
.
filter
(
item
=>
item
.
code
.
indexOf
(
code
)
===
0
);
}
if
(
typeToColumnsPlaceholder
[
type
]
&&
result
.
length
)
{
// set columns placeholder
const
codeFill
=
type
===
'
province
'
?
''
:
type
===
'
city
'
?
COLUMNSPLACEHOLDERCODE
.
slice
(
2
,
4
)
:
COLUMNSPLACEHOLDERCODE
.
slice
(
4
,
6
);
result
.
unshift
({
code
:
`
${
code
}${
codeFill
}
`
,
name
:
typeToColumnsPlaceholder
[
type
]
});
}
return
result
;
},
getIndex
(
type
,
code
)
{
let
compareNum
=
type
===
'
province
'
?
2
:
type
===
'
city
'
?
4
:
6
;
const
list
=
this
.
getList
(
type
,
code
.
slice
(
0
,
compareNum
-
2
));
// oversea code
if
(
code
[
0
]
===
'
9
'
&&
type
===
'
province
'
)
{
compareNum
=
1
;
}
code
=
code
.
slice
(
0
,
compareNum
);
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
)
{
if
(
list
[
i
].
code
.
slice
(
0
,
compareNum
)
===
code
)
{
return
i
;
}
}
return
0
;
},
setValues
()
{
const
county
=
this
.
getConfig
(
'
county
'
);
let
{
code
}
=
this
;
if
(
!
code
)
{
if
(
this
.
data
.
columnsPlaceholder
.
length
)
{
code
=
COLUMNSPLACEHOLDERCODE
;
}
else
if
(
Object
.
keys
(
county
)[
0
])
{
code
=
Object
.
keys
(
county
)[
0
];
}
else
{
code
=
''
;
}
}
const
province
=
this
.
getList
(
'
province
'
);
const
city
=
this
.
getList
(
'
city
'
,
code
.
slice
(
0
,
2
));
const
picker
=
this
.
getPicker
();
if
(
!
picker
)
{
return
;
}
const
stack
=
[];
stack
.
push
(
picker
.
setColumnValues
(
0
,
province
,
false
));
stack
.
push
(
picker
.
setColumnValues
(
1
,
city
,
false
));
if
(
city
.
length
&&
code
.
slice
(
2
,
4
)
===
'
00
'
)
{
[{
code
}]
=
city
;
}
stack
.
push
(
picker
.
setColumnValues
(
2
,
this
.
getList
(
'
county
'
,
code
.
slice
(
0
,
4
)),
false
));
return
Promise
.
all
(
stack
)
.
catch
(()
=>
{
})
.
then
(()
=>
picker
.
setIndexes
([
this
.
getIndex
(
'
province
'
,
code
),
this
.
getIndex
(
'
city
'
,
code
),
this
.
getIndex
(
'
county
'
,
code
)
]))
.
catch
(()
=>
{
});
},
getValues
()
{
const
picker
=
this
.
getPicker
();
return
picker
?
picker
.
getValues
().
filter
(
value
=>
!!
value
)
:
[];
},
getDetail
()
{
const
values
=
this
.
getValues
();
const
area
=
{
code
:
''
,
country
:
''
,
province
:
''
,
city
:
''
,
county
:
''
};
if
(
!
values
.
length
)
{
return
area
;
}
const
names
=
values
.
map
((
item
)
=>
item
.
name
);
area
.
code
=
values
[
values
.
length
-
1
].
code
;
if
(
area
.
code
[
0
]
===
'
9
'
)
{
area
.
country
=
names
[
1
]
||
''
;
area
.
province
=
names
[
2
]
||
''
;
}
else
{
area
.
province
=
names
[
0
]
||
''
;
area
.
city
=
names
[
1
]
||
''
;
area
.
county
=
names
[
2
]
||
''
;
}
return
area
;
},
reset
(
code
)
{
this
.
code
=
code
||
''
;
return
this
.
setValues
();
}
}
});
litemall-wx/lib/vant-weapp/area/index.json
0 → 100644
View file @
b1af78f9
{
"component"
:
true
,
"usingComponents"
:
{
"van-picker"
:
"../picker/index"
}
}
litemall-wx/lib/vant-weapp/area/index.wxml
0 → 100644
View file @
b1af78f9
<van-picker
class="van-area__picker"
active-class="active-class"
toolbar-class="toolbar-class"
column-class="column-class"
show-toolbar
value-key="name"
title="{{ title }}"
loading="{{ loading }}"
columns="{{ displayColumns }}"
item-height="{{ itemHeight }}"
visible-item-count="{{ visibleItemCount }}"
cancel-button-text="{{ cancelButtonText }}"
confirm-button-text="{{ confirmButtonText }}"
bind:change="onChange"
bind:confirm="onConfirm"
bind:cancel="onCancel"
/>
litemall-wx/lib/vant-weapp/area/index.wxss
0 → 100644
View file @
b1af78f9
@import '../common/index.wxss';
\ No newline at end of file
litemall-wx/lib/vant-weapp/card/index.d.ts
0 → 100644
View file @
b1af78f9
export
{};
litemall-wx/lib/vant-weapp/card/index.js
0 → 100644
View file @
b1af78f9
import
{
link
}
from
'
../mixins/link
'
;
import
{
VantComponent
}
from
'
../common/component
'
;
VantComponent
({
classes
:
[
'
num-class
'
,
'
desc-class
'
,
'
thumb-class
'
,
'
title-class
'
,
'
price-class
'
,
'
origin-price-class
'
,
],
mixins
:
[
link
],
props
:
{
tag
:
String
,
num
:
String
,
desc
:
String
,
thumb
:
String
,
title
:
String
,
price
:
String
,
centered
:
Boolean
,
lazyLoad
:
Boolean
,
thumbLink
:
String
,
originPrice
:
String
,
thumbMode
:
{
type
:
String
,
value
:
'
aspectFit
'
},
currency
:
{
type
:
String
,
value
:
'
¥
'
}
},
methods
:
{
onClickThumb
()
{
this
.
jumpLink
(
'
thumbLink
'
);
}
}
});
litemall-wx/lib/vant-weapp/card/index.json
0 → 100644
View file @
b1af78f9
{
"component"
:
true
,
"usingComponents"
:
{
"van-tag"
:
"../tag/index"
}
}
litemall-wx/lib/vant-weapp/card/index.wxml
0 → 100644
View file @
b1af78f9
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="custom-class van-card">
<view class="{{ utils.bem('card__header', { center: centered }) }}">
<view class="van-card__thumb" bind:tap="onClickThumb">
<image
wx:if="{{ thumb }}"
src="{{ thumb }}"
mode="{{ thumbMode }}"
lazy-load="{{ lazyLoad }}"
class="van-card__img thumb-class"
/>
<slot name="thumb" />
<van-tag
wx:if="{{ tag }}"
mark
type="danger"
custom-class="van-card__tag"
>
{{ tag }}
</van-tag>
</view>
<view class="van-card__content">
<view wx:if="{{ title }}" class="van-card__title title-class">{{ title }}</view>
<slot wx:else name="title" />
<view wx:if="{{ desc }}" class="van-card__desc desc-class">{{ desc }}</view>
<slot wx:else name="desc" />
<slot name="tags" />
<view class="van-card__bottom">
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }} {{ price }}</view>
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
<slot name="bottom" />
</view>
</view>
</view>
<view class="van-card__footer">
<slot name="footer" />
</view>
</view>
litemall-wx/lib/vant-weapp/card/index.wxss
0 → 100644
View file @
b1af78f9
@import '../common/index.wxss';.van-card{position:relative;box-sizing:border-box;padding:8px 16px;padding:var(--card-padding,8px 16px);font-size:12px;font-size:var(--card-font-size,12px);color:#323233;color:var(--card-text-color,#323233);background-color:#fafafa;background-color:var(--card-background-color,#fafafa)}.van-card__header{display:-webkit-flex;display:flex}.van-card__header--center{-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center}.van-card__thumb{position:relative;-webkit-flex:none;flex:none;width:90px;width:var(--card-thumb-size,90px);height:90px;height:var(--card-thumb-size,90px);margin-right:8px;margin-right:var(--padding-xs,8px)}.van-card__thumb:empty{display:none}.van-card__img{width:100%;height:100%}.van-card__content{position:relative;-webkit-flex:1;flex:1;min-width:0}.van-card__desc,.van-card__title{word-wrap:break-word}.van-card__title{font-weight:700;line-height:16px;line-height:var(--card-title-line-height,16px)}.van-card__desc{line-height:20px;line-height:var(--card-desc-line-height,20px);color:#646566;color:var(--card-desc-color,#646566)}.van-card__bottom{line-height:20px}.van-card__price{display:inline-block;font-weight:700;color:#ee0a24;color:var(--card-price-color,#ee0a24)}.van-card__origin-price{display:inline-block;margin-left:5px;text-decoration:line-through;font-size:10px;font-size:var(--card-origin-price-font-size,10px);color:#646566;color:var(--card-origin-price-color,#646566)}.van-card__num{float:right}.van-card__tag{position:absolute;top:2px;left:0}.van-card__footer{-webkit-flex:none;flex:none;width:100%;text-align:right}
\ No newline at end of file
litemall-wx/lib/vant-weapp/cell-group/index.d.ts
0 → 100644
View file @
b1af78f9
export
{};
litemall-wx/lib/vant-weapp/cell-group/index.js
0 → 100644
View file @
b1af78f9
import
{
VantComponent
}
from
'
../common/component
'
;
VantComponent
({
props
:
{
title
:
String
,
border
:
{
type
:
Boolean
,
value
:
true
}
}
});
litemall-wx/lib/vant-weapp/cell-group/index.json
0 → 100644
View file @
b1af78f9
{
"component"
:
true
}
\ No newline at end of file
litemall-wx/lib/vant-weapp/cell-group/index.wxml
0 → 100644
View file @
b1af78f9
<view
wx:if="{{ title }}"
class="van-cell-group__title"
>
{{ title }}
</view>
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
<slot />
</view>
litemall-wx/lib/vant-weapp/cell-group/index.wxss
0 → 100644
View file @
b1af78f9
@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}
\ No newline at end of file
Prev
1
2
3
4
5
…
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