mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 00:45:55 +08:00
智慧宿舍系统小程序
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
var component_1 = require('../common/component');
|
||||
var color_1 = require('../common/color');
|
||||
var utils_1 = require('../common/utils');
|
||||
component_1.VantComponent({
|
||||
props: {
|
||||
inactive: Boolean,
|
||||
percentage: {
|
||||
type: Number,
|
||||
observer: 'setLeft',
|
||||
},
|
||||
pivotText: String,
|
||||
pivotColor: String,
|
||||
trackColor: String,
|
||||
showPivot: {
|
||||
type: Boolean,
|
||||
value: true,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
value: color_1.BLUE,
|
||||
},
|
||||
textColor: {
|
||||
type: String,
|
||||
value: '#fff',
|
||||
},
|
||||
strokeWidth: {
|
||||
type: null,
|
||||
value: 4,
|
||||
},
|
||||
},
|
||||
data: {
|
||||
right: 0,
|
||||
},
|
||||
mounted: function () {
|
||||
this.setLeft();
|
||||
},
|
||||
methods: {
|
||||
setLeft: function () {
|
||||
var _this = this;
|
||||
Promise.all([
|
||||
utils_1.getRect(this, '.van-progress'),
|
||||
utils_1.getRect(this, '.van-progress__pivot'),
|
||||
]).then(function (_a) {
|
||||
var portion = _a[0],
|
||||
pivot = _a[1];
|
||||
if (portion && pivot) {
|
||||
_this.setData({
|
||||
right: (pivot.width * (_this.data.percentage - 100)) / 100,
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view
|
||||
class="van-progress custom-class"
|
||||
style="{{ computed.rootStyle({ strokeWidth, trackColor }) }}"
|
||||
>
|
||||
<view
|
||||
class="van-progress__portion"
|
||||
style="{{ computed.portionStyle({ percentage, inactive, color }) }}"
|
||||
>
|
||||
<view
|
||||
wx:if="{{ showPivot && computed.pivotText(pivotText, percentage) }}"
|
||||
style="{{ computed.pivotStyle({ textColor, pivotColor, inactive, color, right }) }}"
|
||||
class="van-progress__pivot"
|
||||
>
|
||||
{{ computed.pivotText(pivotText, percentage) }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,36 @@
|
||||
/* eslint-disable */
|
||||
var utils = require('../wxs/utils.wxs');
|
||||
var style = require('../wxs/style.wxs');
|
||||
|
||||
function pivotText(pivotText, percentage) {
|
||||
return pivotText || percentage + '%';
|
||||
}
|
||||
|
||||
function rootStyle(data) {
|
||||
return style({
|
||||
'height': data.strokeWidth ? utils.addUnit(data.strokeWidth) : '',
|
||||
'background': data.trackColor,
|
||||
});
|
||||
}
|
||||
|
||||
function portionStyle(data) {
|
||||
return style({
|
||||
background: data.inactive ? '#cacaca' : data.color,
|
||||
width: data.percentage ? data.percentage + '%' : '',
|
||||
});
|
||||
}
|
||||
|
||||
function pivotStyle(data) {
|
||||
return style({
|
||||
color: data.textColor,
|
||||
right: data.right + 'px',
|
||||
background: data.pivotColor ? data.pivotColor : data.inactive ? '#cacaca' : data.color,
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
pivotText: pivotText,
|
||||
rootStyle: rootStyle,
|
||||
portionStyle: portionStyle,
|
||||
pivotStyle: pivotStyle,
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
@import '../common/index.wxss';.van-progress{position:relative;height:4px;height:var(--progress-height,4px);border-radius:4px;border-radius:var(--progress-height,4px);background:#ebedf0;background:var(--progress-background-color,#ebedf0)}.van-progress__portion{position:absolute;left:0;height:100%;border-radius:inherit;background:#1989fa;background:var(--progress-color,#1989fa)}.van-progress__pivot{position:absolute;top:50%;box-sizing:border-box;min-width:3.6em;text-align:center;word-break:keep-all;border-radius:1em;-webkit-transform:translateY(-50%);transform:translateY(-50%);color:#fff;color:var(--progress-pivot-text-color,#fff);padding:0 5px;padding:var(--progress-pivot-padding,0 5px);font-size:10px;font-size:var(--progress-pivot-font-size,10px);line-height:1.6;line-height:var(--progress-pivot-line-height,1.6);background-color:#1989fa;background-color:var(--progress-pivot-background-color,#1989fa)}
|
||||
Reference in New Issue
Block a user