提交初始版本,使用vant ui库
This commit is contained in:
1
miniprogram_npm/@vant/weapp/icon/index.d.ts
vendored
Normal file
1
miniprogram_npm/@vant/weapp/icon/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
23
miniprogram_npm/@vant/weapp/icon/index.js
Normal file
23
miniprogram_npm/@vant/weapp/icon/index.js
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var component_1 = require("../common/component");
|
||||
(0, component_1.VantComponent)({
|
||||
classes: ['info-class'],
|
||||
props: {
|
||||
dot: Boolean,
|
||||
info: null,
|
||||
size: null,
|
||||
color: String,
|
||||
customStyle: String,
|
||||
classPrefix: {
|
||||
type: String,
|
||||
value: 'van-icon',
|
||||
},
|
||||
name: String,
|
||||
},
|
||||
methods: {
|
||||
onClick: function () {
|
||||
this.$emit('click');
|
||||
},
|
||||
},
|
||||
});
|
6
miniprogram_npm/@vant/weapp/icon/index.json
Normal file
6
miniprogram_npm/@vant/weapp/icon/index.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"van-info": "../info/index"
|
||||
}
|
||||
}
|
20
miniprogram_npm/@vant/weapp/icon/index.wxml
Normal file
20
miniprogram_npm/@vant/weapp/icon/index.wxml
Normal file
@@ -0,0 +1,20 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view
|
||||
class="{{ computed.rootClass({ classPrefix, name }) }}"
|
||||
style="{{ computed.rootStyle({ customStyle, color, size }) }}"
|
||||
bindtap="onClick"
|
||||
>
|
||||
<van-info
|
||||
wx:if="{{ info !== null || dot }}"
|
||||
dot="{{ dot }}"
|
||||
info="{{ info }}"
|
||||
custom-class="van-icon__info info-class"
|
||||
/>
|
||||
<image
|
||||
wx:if="{{ computed.isImage(name) }}"
|
||||
src="{{ name }}"
|
||||
mode="aspectFit"
|
||||
class="van-icon__image"
|
||||
/>
|
||||
</view>
|
43
miniprogram_npm/@vant/weapp/icon/index.wxs
Normal file
43
miniprogram_npm/@vant/weapp/icon/index.wxs
Normal file
@@ -0,0 +1,43 @@
|
||||
/* eslint-disable */
|
||||
var style = require('../wxs/style.wxs');
|
||||
var addUnit = require('../wxs/add-unit.wxs');
|
||||
|
||||
function isImage(name) {
|
||||
return name.indexOf('/') !== -1;
|
||||
}
|
||||
|
||||
function rootClass(data) {
|
||||
var classes = ['custom-class'];
|
||||
|
||||
if (data.classPrefix !== 'van-icon') {
|
||||
classes.push('van-icon--custom')
|
||||
}
|
||||
|
||||
if (data.classPrefix != null) {
|
||||
classes.push(data.classPrefix);
|
||||
}
|
||||
|
||||
if (isImage(data.name)) {
|
||||
classes.push('van-icon--image');
|
||||
} else if (data.classPrefix != null) {
|
||||
classes.push(data.classPrefix + '-' + data.name);
|
||||
}
|
||||
|
||||
return classes.join(' ');
|
||||
}
|
||||
|
||||
function rootStyle(data) {
|
||||
return style([
|
||||
{
|
||||
color: data.color,
|
||||
'font-size': addUnit(data.size),
|
||||
},
|
||||
data.customStyle,
|
||||
]);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
isImage: isImage,
|
||||
rootClass: rootClass,
|
||||
rootStyle: rootStyle,
|
||||
};
|
1
miniprogram_npm/@vant/weapp/icon/index.wxss
Normal file
1
miniprogram_npm/@vant/weapp/icon/index.wxss
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user