vant
This commit is contained in:
1
utils/dist/icon/index.d.ts
vendored
Normal file
1
utils/dist/icon/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
39
utils/dist/icon/index.js
vendored
Normal file
39
utils/dist/icon/index.js
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
import { VantComponent } from '../common/component';
|
||||
import { addUnit } from '../common/utils';
|
||||
VantComponent({
|
||||
props: {
|
||||
dot: Boolean,
|
||||
info: null,
|
||||
size: {
|
||||
type: null,
|
||||
observer: 'setSizeWithUnit'
|
||||
},
|
||||
color: String,
|
||||
customStyle: String,
|
||||
classPrefix: {
|
||||
type: String,
|
||||
value: 'van-icon'
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
observer(val) {
|
||||
this.setData({
|
||||
isImageName: val.indexOf('/') !== -1
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
data: {
|
||||
sizeWithUnit: null,
|
||||
},
|
||||
methods: {
|
||||
onClick() {
|
||||
this.$emit('click');
|
||||
},
|
||||
setSizeWithUnit(size) {
|
||||
this.setData({
|
||||
sizeWithUnit: addUnit(size)
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
6
utils/dist/icon/index.json
vendored
Normal file
6
utils/dist/icon/index.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-info": "../info/index"
|
||||
}
|
||||
}
|
||||
18
utils/dist/icon/index.wxml
vendored
Normal file
18
utils/dist/icon/index.wxml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<view
|
||||
class="custom-class {{ classPrefix }} {{ isImageName ? 'van-icon--image' : classPrefix + '-' + name }}"
|
||||
style="{{ color ? 'color: ' + color + ';' : '' }}{{ size ? 'font-size: ' + sizeWithUnit + ';' : '' }}{{ customStyle }}"
|
||||
bind:tap="onClick"
|
||||
>
|
||||
<van-info
|
||||
wx:if="{{ info !== null || dot }}"
|
||||
dot="{{ dot }}"
|
||||
info="{{ info }}"
|
||||
custom-class="van-icon__info"
|
||||
/>
|
||||
<image
|
||||
wx:if="{{ isImageName }}"
|
||||
src="{{ name }}"
|
||||
mode="aspectFit"
|
||||
class="van-icon__image"
|
||||
/>
|
||||
</view>
|
||||
1
utils/dist/icon/index.wxss
vendored
Normal file
1
utils/dist/icon/index.wxss
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user