Skip to content

Commit

Permalink
feat: 优化代码以及单测补充完毕
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jan 24, 2025
1 parent 6ec3068 commit e833ca8
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 179 deletions.
12 changes: 12 additions & 0 deletions docs/config/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ module.exports = [
{
title: 'FloatBall 悬浮球',
path: '/components/base/float-ball'
},
{
title: 'Loading 加载',
path: '/components/base/loading'
}
// {
// title: 'Style 内置样式'
Expand Down Expand Up @@ -104,6 +108,14 @@ module.exports = [
{
title: 'TimePicker 时间选择器',
path: '/components/base/time-picker'
},
{
title: 'Rate 评分',
path: '/components/base/rate'
},
{
title: 'Switch 滑动开关',
path: '/components/base/switch'
}
]
},
Expand Down
19 changes: 6 additions & 13 deletions example/pages/loading/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
## Cube-Segment-Picker
## Cube-Button-Group 按钮组

<card>

### 介绍

段选择器,用于实现多段的选择,比如选择时间段:2010年9月1日 - 2014年6月30日
加载,提供了可自定义大小的加载动画

</card>

## 示例
### 示例

<card>

### 城市选择器
### 水平排列

可以配置多段城市选择
通过设置`direction="horizontal"`将按钮水平排列

<!-- @example: segment-city-picker -->
<!-- @example: index -->

</card>

<card>

### 日期选择器

<!-- @example: segment-date-picker -->

</card>
30 changes: 29 additions & 1 deletion example/pages/rate/index.mpx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<base-container>
<view class="content">
<view class="rate-wrapper">
<rate wx:model="{{value}}" wx:model-prop="value" disabled="{{disabled}}" isCustomize="{{customize}}" max="{{_max}}" justify="{{justify}}" allowHalf="{{allowHalf}}">
<rate wx:model="{{value}}" wx:model-prop="value" bindchange="updateCurrentPoint" disabled="{{disabled}}" isCustomize="{{customize}}" max="{{_max}}" justify="{{justify}}" allowHalf="{{allowHalf}}">
<rate-item wx:for="{{_max}}" wx:key="item" index="{{item}}" value="{{value}}">
<view class="rate-item-demo"></view>
</rate-item>
Expand All @@ -30,6 +30,24 @@
bind:input="updateMaxLength"
/>
</view>
<view class="group-item">
<view class="item sub">Input Point</view>
<input
class="input-maxlength"
type="number"
value="{{ currentValue + '' }}"
bind:input="updateValue"
/>
</view>
<view class="group-item">
<view class="item sub">Star Point</view>
<input
class="input-maxlength"
type="number"
disabled="{{true}}"
value="{{ value + '' }}"
/>
</view>
<view class="group-item">
<view class="item">Justify</view>
<switch
Expand Down Expand Up @@ -72,6 +90,7 @@
createPage({
data: {
value: 3.4,
currentValue: 3.4,
max: '5',
customize: false,
justify: false,
Expand All @@ -98,6 +117,15 @@
this.max = '9'
}
},
updateValue (e) {
const { value } = e.detail
this.currentValue = value
this.value = Number(value)
},
updateCurrentPoint (e) {
const { value } = e.detail
this.currentValue = value
},
updateJustify (e) {
const { value } = e.detail
this.justify = value
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
collectCoverage: false,
testMatch: [
'**/__tests__/**/*.spec.js'
// '**/__tests__/**/rate.spec.js'
],
collectCoverageFrom: ['/packages/mpx-cube-ui/src/components/**/*.{js,mpx,ts}'],
coverageDirectory: 'test/coverage',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"docs:prod": "npm run example:build && NODE_ENV=production npm run docs:build && cp -r ./example/dist/web ./docs/.vuepress/dist/example",
"example:build": "cd example && npm run build:web",
"example:dev": "cd example && npm run watch:web",
"example:mp:dev": "cd example && npm run watch:ali",
"example:mp:dev": "cd example && npm run watch:wx",
"fix": "eslint --fix --ext .js,.ts,.mpx packages/",
"lint": "eslint --ext .js,.ts,.mpx packages/",
"prepare": "husky install",
Expand Down
Loading

0 comments on commit e833ca8

Please sign in to comment.