Skip to content

Commit

Permalink
feat: Indexbr => IndexBar
Browse files Browse the repository at this point in the history
  • Loading branch information
wujunwen committed Dec 16, 2022
1 parent 95ccc83 commit dd31420
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 23 deletions.
4 changes: 2 additions & 2 deletions demo/app.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"pages": [
"pages/index/index",
"pages/IndexBar/index",
"pages/ActionSheet/index",
"pages/Form/index",
"pages/FormLayout/index",
Expand Down Expand Up @@ -72,8 +73,7 @@
"pages/RateCustom/index",
"pages/Slider/index",
"pages/TabsElevator/index",
"pages/Indexbar/index",
"pages/IndexbarScrollView/index"
"pages/IndexBarScrollView/index"
],
"window": {
"enableWK": "YES",
Expand Down
2 changes: 1 addition & 1 deletion demo/pages/Indexbar/index.axml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<view class="base">
<list header="基本使用"></list>
<view class="indexbar">
<indexbar items="{{items}}"/>
<index-bar items="{{items}}"/>
</view>
</view>
4 changes: 2 additions & 2 deletions demo/pages/Indexbar/index.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"defaultTitle": "Indexbar",
"defaultTitle": "IndexBar",
"pullRefresh": "NO",
"showProgress": "NO",
"allowsBounceVertical": "NO",
"usingComponents": {
"indexbar": "../../../src/Indexbar/index",
"index-bar": "../../../src/IndexBar/index",
"list": "../../../src/List/index"
}
}
4 changes: 2 additions & 2 deletions demo/pages/IndexbarScrollView/index.axml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<view class="base">
<indexbar
<index-bar
className="indexbar"
items="{{items}}"
defaultCurrent="A"
Expand All @@ -11,5 +11,5 @@
</list-item>
</list>
</view>
</indexbar>
</index-bar>
</view>
4 changes: 2 additions & 2 deletions demo/pages/IndexbarScrollView/index.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"defaultTitle": "Indexbar",
"defaultTitle": "IndexBar",
"pullRefresh": "NO",
"showProgress": "NO",
"allowsBounceVertical": "NO",
"usingComponents": {
"indexbar": "../../../src/Indexbar/index",
"index-bar": "../../../src/IndexBar/index",
"list": "../../../src/List/index",
"list-item": "../../../src/List/ListItem/index"
}
Expand Down
4 changes: 2 additions & 2 deletions demo/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ export const componentList = [
path: '/pages/Avatar/index',
},
{
name: 'Indexbar',
name: 'IndexBar',
nameZN: '索引',
path: '/pages/IndexbarScrollView/index',
path: '/pages/IndexBarScrollView/index',
},
{
name: 'Collapse',
Expand Down
15 changes: 8 additions & 7 deletions src/Indexbar/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ group:
toc: 'content'
---

# Indexbar 索引
# IndexBar 索引

侧边索引组件

Expand All @@ -18,10 +18,10 @@ toc: 'content'
## 代码示例

### 基本使用
<code src='pages/Indexbar/index'></code>
<code src='pages/IndexBar/index'></code>

### 结合列表使用
<code src='pages/IndexbarScrollView/index'></code>
<code src='pages/IndexBarScrollView/index'></code>

## API
| 属性 | 说明 | 类型 | 默认值 |
Expand All @@ -37,8 +37,9 @@ toc: 'content'
| vibrate | 索引改变时是否震动 | boolean | false |
| onChange | 索引改变时回调 | (value: [Item](#item), index: number) => void |

### Item
| 属性 | 说明 | 类型 | 默认值 |


#### Item
| 属性 | 说明 | 类型 | 默认值 |
| ---------------|----------------------|------------|-------|
| label | 索引标识 | `string` | - |
| disablePreview | 禁用索引触发时的预览效果 | `boolean` | - |

4 changes: 2 additions & 2 deletions src/Indexbar/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IndexbarDefaultProps } from './props';
import { IndexBarDefaultProps } from './props';

Component({
props: IndexbarDefaultProps,
props: IndexBarDefaultProps,
data: {
touchClientY: 0, // 按下触摸点所处页面的高度
touchKeyIndex: -1, // 选中的字母
Expand Down
4 changes: 2 additions & 2 deletions src/Indexbar/props.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ interface ItemObj {
disablePreview?: boolean
}

export interface IndexbarProps extends IBaseProps {
export interface IndexBarProps extends IBaseProps {
/**
* @description 触发的索引样式
*/
Expand Down Expand Up @@ -36,4 +36,4 @@ export interface IndexbarProps extends IBaseProps {
onChange?: (value: ItemObj, index: number) => void,
}

export declare const IndexbarDefaultProps: Partial<IndexbarProps>;
export declare const IndexBarDefaultProps: Partial<IndexBarProps>;
3 changes: 2 additions & 1 deletion src/Indexbar/props.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export const IndexbarDefaultProps = {
export const IndexBarDefaultProps = {
className: '',
activeClassName: '',
defaultCurrent: '',
current: '',
vibrate: true,
items: [],
size: 16,
style: '',
onChange: (value, index) => {},
}

0 comments on commit dd31420

Please sign in to comment.