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
561ec67b
Commit
561ec67b
authored
Dec 04, 2019
by
Junling Bu
Browse files
feat[litemall-wx]: 采用vant-weapp tag组件
parent
52c0f60d
Changes
54
Hide whitespace changes
Inline
Side-by-side
litemall-wx/app.json
View file @
561ec67b
...
...
@@ -86,5 +86,8 @@
"downloadFile"
:
10000
},
"debug"
:
true
,
"usingComponents"
:
{
"van-tag"
:
"./lib/vant-weapp/tag/index"
},
"sitemapLocation"
:
"sitemap.json"
}
\ No newline at end of file
litemall-wx/lib/vant-weapp/common/color.d.ts
0 → 100644
View file @
561ec67b
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
"
;
litemall-wx/lib/vant-weapp/common/color.js
0 → 100644
View file @
561ec67b
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
'
;
litemall-wx/lib/vant-weapp/common/component.d.ts
0 → 100644
View file @
561ec67b
import
{
VantComponentOptions
,
CombinedComponentInstance
}
from
'
../definitions/index
'
;
declare
function
VantComponent
<
Data
,
Props
,
Methods
>
(
vantOptions
?:
VantComponentOptions
<
Data
,
Props
,
Methods
,
CombinedComponentInstance
<
Data
,
Props
,
Methods
>>
):
void
;
export
{
VantComponent
};
litemall-wx/lib/vant-weapp/common/component.js
0 → 100644
View file @
561ec67b
import
{
basic
}
from
'
../mixins/basic
'
;
import
{
observe
}
from
'
../mixins/observer/index
'
;
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
'
,
mixins
:
'
behaviors
'
,
methods
:
'
methods
'
,
beforeCreate
:
'
created
'
,
created
:
'
attached
'
,
mounted
:
'
ready
'
,
relations
:
'
relations
'
,
destroyed
:
'
detached
'
,
classes
:
'
externalClasses
'
});
const
{
relation
}
=
vantOptions
;
if
(
relation
)
{
options
.
relations
=
Object
.
assign
(
options
.
relations
||
{},
{
[
`../
${
relation
.
name
}
/index`
]:
relation
});
}
// add default externalClasses
options
.
externalClasses
=
options
.
externalClasses
||
[];
options
.
externalClasses
.
push
(
'
custom-class
'
);
// add default behaviors
options
.
behaviors
=
options
.
behaviors
||
[];
options
.
behaviors
.
push
(
basic
);
// map field to form-field behavior
if
(
vantOptions
.
field
)
{
options
.
behaviors
.
push
(
'
wx://form-field
'
);
}
// add default options
options
.
options
=
{
multipleSlots
:
true
,
addGlobalClass
:
true
};
observe
(
vantOptions
,
options
);
Component
(
options
);
}
export
{
VantComponent
};
litemall-wx/lib/vant-weapp/common/index.wxss
0 → 100644
View file @
561ec67b
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}.van-clearfix:after{display:table;clear:both;content:""}.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{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #eee;-webkit-transform:scale(.5);transform:scale(.5)}.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
litemall-wx/lib/vant-weapp/common/style/clearfix.wxss
0 → 100644
View file @
561ec67b
.van-clearfix:after{display:table;clear:both;content:""}
\ No newline at end of file
litemall-wx/lib/vant-weapp/common/style/ellipsis.wxss
0 → 100644
View file @
561ec67b
.van-ellipsis{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.van-multi-ellipsis--l2{-webkit-line-clamp:2}.van-multi-ellipsis--l2,.van-multi-ellipsis--l3{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}.van-multi-ellipsis--l3{-webkit-line-clamp:3}
\ No newline at end of file
litemall-wx/lib/vant-weapp/common/style/hairline.wxss
0 → 100644
View file @
561ec67b
.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{position:absolute;box-sizing:border-box;-webkit-transform-origin:center;transform-origin:center;content:" ";pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid #eee;-webkit-transform:scale(.5);transform:scale(.5)}.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
litemall-wx/lib/vant-weapp/common/style/mixins/clearfix.wxss
0 → 100644
View file @
561ec67b
litemall-wx/lib/vant-weapp/common/style/mixins/ellipsis.wxss
0 → 100644
View file @
561ec67b
litemall-wx/lib/vant-weapp/common/style/mixins/hairline.wxss
0 → 100644
View file @
561ec67b
litemall-wx/lib/vant-weapp/common/style/theme.wxss
0 → 100644
View file @
561ec67b
litemall-wx/lib/vant-weapp/common/style/var.wxss
0 → 100644
View file @
561ec67b
litemall-wx/lib/vant-weapp/common/utils.d.ts
0 → 100644
View file @
561ec67b
/// <reference types="miniprogram-api-typings" />
export
declare
function
isDef
(
value
:
any
):
boolean
;
export
declare
function
isObj
(
x
:
any
):
boolean
;
export
declare
function
isNumber
(
value
:
any
):
boolean
;
export
declare
function
range
(
num
:
number
,
min
:
number
,
max
:
number
):
number
;
export
declare
function
nextTick
(
fn
:
Function
):
void
;
export
declare
function
getSystemInfoSync
():
WechatMiniprogram
.
GetSystemInfoSuccessCallbackResult
;
export
declare
function
addUnit
(
value
?:
string
|
number
):
string
|
undefined
;
litemall-wx/lib/vant-weapp/common/utils.js
0 → 100644
View file @
561ec67b
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
range
(
num
,
min
,
max
)
{
return
Math
.
min
(
Math
.
max
(
num
,
min
),
max
);
}
export
function
nextTick
(
fn
)
{
setTimeout
(()
=>
{
fn
();
},
1000
/
30
);
}
let
systemInfo
=
null
;
export
function
getSystemInfoSync
()
{
if
(
systemInfo
==
null
)
{
systemInfo
=
wx
.
getSystemInfoSync
();
}
return
systemInfo
;
}
export
function
addUnit
(
value
)
{
if
(
!
isDef
(
value
))
{
return
undefined
;
}
value
=
String
(
value
);
return
isNumber
(
value
)
?
`
${
value
}
px`
:
value
;
}
litemall-wx/lib/vant-weapp/mixins/basic.d.ts
0 → 100644
View file @
561ec67b
export
declare
const
basic
:
string
;
litemall-wx/lib/vant-weapp/mixins/basic.js
0 → 100644
View file @
561ec67b
export
const
basic
=
Behavior
({
methods
:
{
$emit
(...
args
)
{
this
.
triggerEvent
(...
args
);
},
getRect
(
selector
,
all
)
{
return
new
Promise
(
resolve
=>
{
wx
.
createSelectorQuery
()
.
in
(
this
)[
all
?
'
selectAll
'
:
'
select
'
](
selector
)
.
boundingClientRect
(
rect
=>
{
if
(
all
&&
Array
.
isArray
(
rect
)
&&
rect
.
length
)
{
resolve
(
rect
);
}
if
(
!
all
&&
rect
)
{
resolve
(
rect
);
}
})
.
exec
();
});
}
}
});
litemall-wx/lib/vant-weapp/mixins/button.d.ts
0 → 100644
View file @
561ec67b
export
declare
const
button
:
string
;
litemall-wx/lib/vant-weapp/mixins/button.js
0 → 100644
View file @
561ec67b
export
const
button
=
Behavior
({
externalClasses
:
[
'
hover-class
'
],
properties
:
{
id
:
String
,
lang
:
{
type
:
String
,
value
:
'
en
'
},
businessId
:
Number
,
sessionFrom
:
String
,
sendMessageTitle
:
String
,
sendMessagePath
:
String
,
sendMessageImg
:
String
,
showMessageCard
:
Boolean
,
appParameter
:
String
,
ariaLabel
:
String
}
});
Prev
1
2
3
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