mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
feat(Icon): remove wxs (#1942)
This commit is contained in:
parent
b685dd73d4
commit
00c090ad07
@ -3,13 +3,20 @@ import { VantComponent } from '../common/component';
|
||||
VantComponent({
|
||||
props: {
|
||||
info: null,
|
||||
name: String,
|
||||
size: String,
|
||||
color: String,
|
||||
customStyle: String,
|
||||
classPrefix: {
|
||||
type: String,
|
||||
value: 'van-icon'
|
||||
},
|
||||
name: {
|
||||
type: String,
|
||||
observer(val) {
|
||||
this.setData({
|
||||
isImageName: val.indexOf('/') !== -1
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
|
||||
<view
|
||||
class="custom-class {{ classPrefix }} {{ utils.isSrc(name) ? 'van-icon--image' : classPrefix + '-' + name }}"
|
||||
class="custom-class {{ classPrefix }} {{ isImageName ? 'van-icon--image' : classPrefix + '-' + name }}"
|
||||
style="{{ color ? 'color: ' + color + ';' : '' }}{{ size ? 'font-size: ' + size + ';' : '' }}{{ customStyle }}"
|
||||
bind:tap="onClick"
|
||||
>
|
||||
@ -11,7 +9,7 @@
|
||||
custom-class="van-icon__info"
|
||||
/>
|
||||
<image
|
||||
wx:if="{{ utils.isSrc(name) }}"
|
||||
wx:if="{{ isImageName }}"
|
||||
src="{{ name }}"
|
||||
mode="aspectFit"
|
||||
class="van-icon__image"
|
||||
|
@ -1,12 +1,7 @@
|
||||
var bem = require('./bem.wxs').bem;
|
||||
var memoize = require('./memoize.wxs').memoize;
|
||||
|
||||
function isSrc(url) {
|
||||
return url.indexOf('http') === 0 || url.indexOf('data:image') === 0 || url.indexOf('//') === 0;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
bem: memoize(bem),
|
||||
isSrc: isSrc,
|
||||
memoize: memoize
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user