白色主题

This commit is contained in:
2023-02-12 19:04:01 +08:00
parent d736a5912f
commit 57ab6fbb49
411 changed files with 1752 additions and 5304 deletions

View File

@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
import { SuperComponent, wxComponent } from '../common/src/index';
import config from '../common/config';
import props from './props';
import { unitConvert } from '../common/utils';
import { unitConvert, getRect } from '../common/utils';
const { prefix } = config;
const name = `${prefix}-rate`;
let Rate = class Rate extends SuperComponent {
@@ -35,10 +35,7 @@ let Rate = class Rate extends SuperComponent {
const { count, allowHalf, gap, value: currentValue, size } = this.properties;
const [touch] = e.touches;
const margin = unitConvert(gap);
const selQuery = this.createSelectorQuery();
selQuery
.select(`.${name}__wrapper`)
.boundingClientRect((rect) => {
getRect(this, `.${name}__wrapper`).then((rect) => {
const { width, left } = rect;
const starWidth = (width - (count - 1) * margin) / count;
const offsetX = touch.pageX - left;
@@ -57,15 +54,14 @@ let Rate = class Rate extends SuperComponent {
this.setData({
tipsVisible: true,
actionType: eventType,
scaleIndex: eventType === 'move' ? Math.ceil(value) : -1,
scaleIndex: Math.ceil(value),
tipsLeft: Math.max(left, 0),
});
}
if (value !== currentValue) {
this._trigger('change', { value });
}
})
.exec();
});
},
onTap(e) {
this.onTouch(e, 'tap');
@@ -86,7 +82,7 @@ let Rate = class Rate extends SuperComponent {
if (actionType === 'move')
return;
this._trigger('change', { value });
setTimeout(() => this.setData({ tipsVisible: false }), 300);
setTimeout(() => this.setData({ tipsVisible: false, scaleIndex: -1 }), 300);
},
};
}