文档优化 (#194)

This commit is contained in:
Yao 2018-04-15 11:21:10 +08:00 committed by GitHub
parent dda2e83bca
commit dc673c25da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 233 additions and 295 deletions

View File

@ -2,6 +2,7 @@
"navigationBarTitleText": "Actionsheet 行动按钮", "navigationBarTitleText": "Actionsheet 行动按钮",
"usingComponents": { "usingComponents": {
"zan-actionsheet": "../../dist/actionsheet/index", "zan-actionsheet": "../../dist/actionsheet/index",
"zan-btn": "../../dist/btn/index" "zan-button": "../../dist/btn/index",
"doc-page": "../../components/doc-page/index"
} }
} }

View File

@ -1,9 +1,11 @@
<view class="container">
<view class="doc-title zan-hairline--bottom zan-hairline--bottom">ACTIONSHEET</view> <doc-page title="ACTIONSHEET">
<view class="zan-btns" style="margin-top: 30vh;"> <view class="zan-btns" style="margin-top: 30vh;">
<button class="zan-btn" bindtap="openActionsheet"> <zan-button bind:btnclick="openActionsheet">
Actionsheet Actionsheet
</button> </zan-button>
</view>
<zan-actionsheet <zan-actionsheet
show="{{ show }}" show="{{ show }}"
actions="{{ actions }}" actions="{{ actions }}"
@ -13,5 +15,4 @@
bind:actionclick="clickAction" bind:actionclick="clickAction"
mask-class="tiny" mask-class="tiny"
/> />
</view> </doc-page>
</view>

View File

@ -1,6 +1,6 @@
const config = require('./config'); const config = require('./config');
Page(Object.assign({}, { Page({
data: { data: {
config, config,
value: 'test', value: 'test',
@ -79,4 +79,4 @@ Page(Object.assign({}, {
}); });
} }
})); });

View File

@ -1,6 +1,9 @@
{ {
"navigationBarTitleText": "Field 输入框", "navigationBarTitleText": "Field 输入框",
"usingComponents": { "usingComponents": {
"zan-field": "../../dist/field/index" "zan-button": "../../dist/btn/index",
"zan-field": "../../dist/field/index",
"zan-panel": "../../dist/panel/index",
"doc-page": "../../components/doc-page/index"
} }
} }

View File

@ -1,9 +1,6 @@
<import src="/dist/field/index.wxml" /> <doc-page title="Field" without-padding>
<doc-page title="Field">
<!-- Field 基础用法 --> <!-- Field 基础用法 -->
<view class="zan-panel-title">基础用法</view> <zan-panel title="基础用法">
<view class="zan-panel">
<zan-field <zan-field
title="{{ config.base.name.title }}" title="{{ config.base.name.title }}"
placeholder="{{ config.base.name.placeholder }}" placeholder="{{ config.base.name.placeholder }}"
@ -30,38 +27,27 @@
disabled="{{ config.base.disabled.disabled }}" disabled="{{ config.base.disabled.disabled }}"
> >
</zan-field> </zan-field>
</view> </zan-panel>
<view class="zan-btns"> <view class="zan-btns">
<button <zan-button type="primary" bind:btnclick="clearInput">清除输入</zan-button>
class="zan-btn zan-btn--primary"
bindtap="clearInput"
>
清除输入
</button>
</view> </view>
<!-- 去除标题后的输入框样式 --> <!-- 去除标题后的输入框样式 -->
<view class="zan-panel-title">无标题输入框</view> <zan-panel title="无标题输入框">
<view class="zan-panel">
<zan-field <zan-field
placeholder="{{ config.notitle.placeholder }}" placeholder="{{ config.notitle.placeholder }}"
value="{{ textareaValue }}" value="{{ textareaValue }}"
> >
</zan-field> </zan-field>
</view> </zan-panel>
<view class="zan-btns"> <view class="zan-btns">
<button <zan-button type="primary" bind:btnclick="clearTextarea">清除输入</zan-button>
class="zan-btn zan-btn--primary"
bindtap="clearTextarea"
>
清除输入
</button>
</view> </view>
<!-- 使用 Field 圆角样式 --> <!-- 使用 Field 圆角样式 -->
<view class="zan-panel-title field__title--radius">圆角输入框</view> <zan-panel title="圆角输入框">
<zan-field <zan-field
title="{{ config.radius.totalPrice.title }}" title="{{ config.radius.totalPrice.title }}"
type="{{ config.radius.totalPrice.type }}" type="{{ config.radius.totalPrice.type }}"
@ -86,9 +72,10 @@
input-type="{{ config.radius.notitle.inputTitle }}" input-type="{{ config.radius.notitle.inputTitle }}"
> >
</zan-field> </zan-field>
</zan-panel>
<view class="zan-panel-title">Form 表单中的field应用</view> <!-- <view class="zan-panel-title">Form 表单中的field应用</view> -->
<form bindsubmit="formSubmit" bindreset="formReset"> <!-- <form bindsubmit="formSubmit" bindreset="formReset">
<view class="zan-panel"> <view class="zan-panel">
<zan-field <zan-field
name="{{ config.form.name.name }}" name="{{ config.form.name.name }}"
@ -110,33 +97,5 @@
formType="reset">重置数据</button> formType="reset">重置数据</button>
</view> </view>
</view> </view>
</form> </form> -->
<view class="zan-panel-title">自定义显示内容</view>
<view class="zan-panel">
<!-- 简单 picker 示例 -->
<view class="zan-cell zan-field">
<view class="zan-cell__hd zan-field__title">选择区域</view>
<picker
mode="selector"
class="zan-field__input zan-cell__bd"
range="{{ area }}"
value="{{ areaIndex }}"
bindchange="onAreaChange"
>
{{ area[areaIndex] }}
</picker>
</view>
<view class="zan-cell zan-field">
<view class="zan-cell__hd zan-field__title">验证码</view>
<input
type="text"
placeholder="请输入短信验证码"
class="zan-field__input zan-cell__bd"/>
<view class="zan-cell__ft">
<button class="zan-btn zan-btn--mini zan-btn--primary">获取验证码</button>
</view>
</view>
</view>
</doc-page> </doc-page>

View File

@ -1,6 +1,8 @@
{ {
"navigationBarTitleText": "Stepper 计数器", "navigationBarTitleText": "Stepper 计数器",
"usingComponents": { "usingComponents": {
"zan-stepper": "../../dist/stepper/index" "zan-stepper": "../../dist/stepper/index",
"zan-panel": "../../dist/panel/index",
"doc-page": "../../components/doc-page/index"
} }
} }

View File

@ -1,5 +1,5 @@
<doc-page title="Stepper"> <doc-page title="Stepper" without-padding>
<view class="zan-panel-title">基础用法</view> <zan-panel title="基础用法">
<view style="padding: 40px 15px"> <view style="padding: 40px 15px">
<zan-stepper <zan-stepper
stepper="{{ stepper1.stepper }}" stepper="{{ stepper1.stepper }}"
@ -10,9 +10,10 @@
> >
</zan-stepper> </zan-stepper>
</view> </view>
</zan-panel>
<!-- small size --> <!-- small size -->
<view class="zan-panel-title">不同尺寸</view> <zan-panel title="不同尺寸-小尺寸类型">
<view style="padding: 40px 15px"> <view style="padding: 40px 15px">
<zan-stepper <zan-stepper
stepper="{{ stepper2.stepper }}" stepper="{{ stepper2.stepper }}"
@ -24,8 +25,9 @@
> >
</zan-stepper> </zan-stepper>
</view> </view>
</zan-panel>
<view class="zan-panel-title">高级用法</view> <zan-panel title="高级用法-每次变动数量自定义">
<view style="padding: 40px 15px"> <view style="padding: 40px 15px">
<zan-stepper <zan-stepper
stepper="{{ stepper3.stepper }}" stepper="{{ stepper3.stepper }}"
@ -37,4 +39,5 @@
> >
</zan-stepper> </zan-stepper>
</view> </view>
</zan-panel>
</doc-page> </doc-page>

View File

@ -1,6 +1,10 @@
{ {
"navigationBarTitleText": "Steps 步骤条", "navigationBarTitleText": "Steps 步骤条",
"usingComponents": { "usingComponents": {
"zan-steps": "../../dist/steps/index" "zan-cell": "../../dist/cell/index",
"zan-cell-group": "../../dist/cell-group/index",
"zan-panel": "../../dist/panel/index",
"zan-steps": "../../dist/steps/index",
"doc-page": "../../components/doc-page/index"
} }
} }

View File

@ -1,70 +1,47 @@
<import src="/dist/steps/index.wxml" /> <doc-page title="STEPS" without-padding>
<zan-panel>
<view class="container"> <zan-cell-group>
<zan-cell>
<view class="doc-title zan-hairline--bottom">STEPS</view>
<view class="zan-panel">
<view class="zan-cell">
<view class="zan-cell__bd">
<zan-steps type="horizon" steps="{{steps}}"></zan-steps> <zan-steps type="horizon" steps="{{steps}}"></zan-steps>
</view> </zan-cell>
</view> <zan-cell>
<view class="zan-cell">
<view class="zan-cell__bd">
<zan-steps type="horizon" steps="{{steps2}}"></zan-steps> <zan-steps type="horizon" steps="{{steps2}}"></zan-steps>
</view> </zan-cell>
</view> <zan-cell>
<view class="zan-cell zan-cell--last-child">
<view class="zan-cell__bd">
<zan-steps type="horizon" steps="{{steps3}}"></zan-steps> <zan-steps type="horizon" steps="{{steps3}}"></zan-steps>
</view> </zan-cell>
</view> </zan-cell-group>
</view> </zan-panel>
<view class="zan-panel-title">有描述的steps</view> <zan-panel title="有描述的steps">
<view class="zan-panel"> <zan-cell-group>
<view class="zan-cell"> <zan-cell>
<view class="zan-cell__bd">
<zan-steps type="horizon" hasDesc steps="{{steps}}"></zan-steps> <zan-steps type="horizon" hasDesc steps="{{steps}}"></zan-steps>
</view> </zan-cell>
</view> <zan-cell>
<view class="zan-cell">
<view class="zan-cell__bd">
<zan-steps type="horizon" hasDesc steps="{{steps2}}"></zan-steps> <zan-steps type="horizon" hasDesc steps="{{steps2}}"></zan-steps>
</view> </zan-cell>
</view> <zan-cell>
<view class="zan-cell zan-cell--last-child">
<view class="zan-cell__bd">
<zan-steps type="horizon" hasDesc steps="{{steps3}}"></zan-steps> <zan-steps type="horizon" hasDesc steps="{{steps3}}"></zan-steps>
</view> </zan-cell>
</view> </zan-cell-group>
</view> </zan-panel>
<view class="zan-panel-title">垂直方向的steps</view> <zan-panel title="垂直方向的steps">
<view class="zan-panel"> <zan-cell-group>
<view class="zan-cell zan-cell"> <zan-cell>
<view class="zan-cell__bd">
<zan-steps type="vertical" hasDesc steps="{{steps}}"></zan-steps> <zan-steps type="vertical" hasDesc steps="{{steps}}"></zan-steps>
</view> </zan-cell>
</view> <zan-cell>
<zan-steps type="vertical" hasDesc steps="{{steps2}}"></zan-steps>
</zan-cell>
</zan-cell-group>
</zan-panel>
<view class="zan-cell zan-cell--last-child"> <zan-panel title="可自定义 class">
<view class="zan-cell__bd"> <zan-cell>
<zan-steps type="vertical" steps="{{steps}}"></zan-steps>
</view>
</view>
</view>
<view class="zan-panel-title">可自定义class</view>
<view class="zan-panel">
<view class="zan-cell__bd">
<zan-steps type="vertical" steps="{{steps}}" className="my-class"></zan-steps> <zan-steps type="vertical" steps="{{steps}}" className="my-class"></zan-steps>
</view> </zan-cell>
</view> </zan-panel>
</doc-page>
</view>

View File

@ -11,26 +11,20 @@ Page(Object.assign({}, Zan.Switch, {
}, },
}, },
syncChange(e, data) { syncChange({ detail }) {
this.setData({ this.setData({
sync: { 'sync.checked': detail.checked
checked: data.checked
}
}); });
}, },
asyncChange(e, data) { asyncChange({ detail }) {
this.setData({ this.setData({
async: { 'async.loading': true
loading: true
}
}); });
setTimeout(() => { setTimeout(() => {
this.setData({ this.setData({
async: { 'async.loading': false,
loading: false, 'async.checked': detail.checked
checked: data.checked
}
}); });
}, 500); }, 500);
} }

View File

@ -1,7 +1,9 @@
{ {
"navigationBarTitleText": "Switch 开关", "navigationBarTitleText": "Switch 开关",
"usingComponents": { "usingComponents": {
"zan-switch": "/packages/switch/index", "zan-switch": "../../dist/switch/index",
"zan-panel": "/packages/panel/index" "zan-panel": "../../dist/panel/index",
"zan-cell": "../../dist/cell/index",
"doc-page": "../../components/doc-page/index"
} }
} }

View File

@ -1,19 +1,21 @@
<import src="/dist/switch/index.wxml" /> <doc-page title="SWITCH" without-padding>
<view class="container">
<view class="doc-title zan-hairline--bottom">SWITCH</view>
<zan-panel title='同步开关'> <zan-panel title='同步开关'>
<zan-cell>
<zan-switch checked="{{sync.checked}}" bind:change="syncChange" /> <zan-switch checked="{{sync.checked}}" bind:change="syncChange" />
</zan-cell>
</zan-panel> </zan-panel>
<zan-panel title='同步开关'> <zan-panel title='同步开关'>
<zan-cell>
<zan-switch checked="{{async.checked}}" disabled="{{ async.disabled }}" loading="{{ async.loading }}" bind:change="asyncChange" /> <zan-switch checked="{{async.checked}}" disabled="{{ async.disabled }}" loading="{{ async.loading }}" bind:change="asyncChange" />
</zan-cell>
</zan-panel> </zan-panel>
<zan-panel title='同步开关'> <zan-panel title='禁止改动的开关'>
<zan-cell>
<zan-switch disabled="{{ false }}" /> <zan-switch disabled="{{ false }}" />
</zan-cell>
</zan-panel> </zan-panel>
</view> </doc-page>

View File

@ -1,5 +1,18 @@
Page({ Page({
data: { data: {
tab: {
list: [{
id: 1,
title: '选项1'
}, {
id: 2,
title: '选项2'
}, {
id: 3,
title: '选项3'
}],
selectedId: 1
},
tab1: { tab1: {
list: [{ list: [{
id: 'all', id: 'all',
@ -13,9 +26,6 @@ Page({
}, { }, {
id: 'send', id: 'send',
title: '待收货' title: '待收货'
}, {
id: 'sign',
title: '已完成订单'
}], }],
selectedId: 'all' selectedId: 'all'
}, },
@ -41,32 +51,7 @@ Page({
}], }],
selectedId: '1', selectedId: '1',
scroll: true, scroll: true,
height: 80 height: 45
},
tab3: {
list: [{
id: '1',
title: '商品1'
}, {
id: '2',
title: '商品2'
}, {
id: '3',
title: '商品3'
}, {
id: '4',
title: '商品4'
}, {
id: '5',
title: '商品5'
}, {
id: '6',
title: '商品6'
}],
selectedId: '1',
height: 45,
scroll: true,
fixed: true
} }
} }
}); });

View File

@ -1,6 +1,7 @@
{ {
"navigationBarTitleText": "Tab 标签", "navigationBarTitleText": "Tab 标签",
"usingComponents": { "usingComponents": {
"zan-tab": "../../dist/tab/index" "zan-tab": "../../dist/tab/index",
"doc-page": "../../components/doc-page/index"
} }
} }

View File

@ -1,16 +1,20 @@
<import src="/dist/tab/index.wxml" /> <doc-page title="TAB" without-padding>
<view class="container"> <view style="margin: 30px 0">
<zan-tab
list="{{ tab.list }}"
selected-id="{{ tab.selectedId }}"
/>
</view>
<view class="doc-title zan-hairline--bottom">TAB</view> <view style="margin: 30px 0">
<view style="margin: 20px 0">
<zan-tab <zan-tab
list="{{ tab1.list }}" list="{{ tab1.list }}"
selected-id="{{ tab1.selectedId }}" selected-id="{{ tab1.selectedId }}"
/> />
</view> </view>
<view style="margin: 20px 0">
<view style="margin: 30px 0">
<zan-tab <zan-tab
list="{{ tab2.list }}" list="{{ tab2.list }}"
selected-id="{{ tab2.selectedId }}" selected-id="{{ tab2.selectedId }}"
@ -18,13 +22,5 @@
height="{{ tab2.height }}" height="{{ tab2.height }}"
/> />
</view> </view>
<view style="margin: 20px 0">
<zan-tab </doc-page>
list="{{ tab3.list }}"
selected-id="{{ tab3.selectedId }}"
scroll="{{ tab3.scroll }}"
fixed="{{ tab3.fixed }}"
height="{{ tab3.height }}"
/>
</view>
</view>

View File

@ -1,6 +1,9 @@
{ {
"navigationBarTitleText": "Tag 标记", "navigationBarTitleText": "Tag 标记",
"usingComponents": { "usingComponents": {
"zan-tag": "/dist/tag/index" "zan-cell": "../../dist/cell/index",
"zan-panel": "../../dist/panel/index",
"zan-tag": "../../dist/tag/index",
"doc-page": "../../components/doc-page/index"
} }
} }

View File

@ -1,30 +1,28 @@
<view class="container"> <doc-page title="Tag" without-padding>
<zan-panel title="基础用法" class="tag-demo">
<view class="doc-title zan-hairline--bottom">Tag</view> <zan-cell>
<view class="zan-panel">
<view class="zan-cell zan-cell--last-child">
<zan-tag>灰色</zan-tag> <zan-tag>灰色</zan-tag>
<zan-tag type="danger">红色</zan-tag> <zan-tag type="danger">红色</zan-tag>
<zan-tag disabled>不可用</zan-tag> <zan-tag disabled>不可用</zan-tag>
</view> </zan-cell>
</view> </zan-panel>
<view class="zan-panel">
<view class="zan-cell zan-cell--last-child"> <zan-panel title="各种不同类型" class="tag-demo">
<zan-cell>
<zan-tag type="danger">会员折扣</zan-tag> <zan-tag type="danger">会员折扣</zan-tag>
<zan-tag type="warn">返现</zan-tag> <zan-tag type="warn">返现</zan-tag>
<zan-tag type="primary">返现</zan-tag> <zan-tag type="primary">返现</zan-tag>
<zan-tag type="primary" disabled>不可用</zan-tag> <zan-tag type="primary" disabled>不可用</zan-tag>
</view> </zan-cell>
</view> </zan-panel>
<view class="zan-panel"> <zan-panel title="镂空 Tag" class="tag-demo">
<view class="zan-cell zan-cell--last-child"> <zan-cell>
<zan-tag plain>灰色</zan-tag> <zan-tag plain>灰色</zan-tag>
<zan-tag type="danger" plain>会员折扣</zan-tag> <zan-tag type="danger" plain>会员折扣</zan-tag>
<zan-tag type="warn" plain>返现</zan-tag> <zan-tag type="warn" plain>返现</zan-tag>
<zan-tag type="primary" plain>返现</zan-tag> <zan-tag type="primary" plain>返现</zan-tag>
<zan-tag type="primary" plain disabled>返现不可用</zan-tag> <zan-tag type="primary" plain disabled>返现不可用</zan-tag>
</view> </zan-cell>
</view> </zan-panel>
</view> </doc-page>

View File

@ -1,3 +1,8 @@
.tag-demo {
display: block;
margin: 15px 0;
}
zan-tag + zan-tag { zan-tag + zan-tag {
margin-left: 10px; margin-left: 10px;
} }

View File

@ -1,6 +1,8 @@
{ {
"navigationBarTitleText": "Toptips 顶部提示", "navigationBarTitleText": "Toptips 顶部提示",
"usingComponents": { "usingComponents": {
"zan-toptips": "../../dist/toptips/index" "zan-button": "../../dist/btn/index",
"zan-toptips": "../../dist/toptips/index",
"doc-page": "../../components/doc-page/index"
} }
} }

View File

@ -1,30 +1,27 @@
<import src="/dist/toptips/index.wxml" /> <doc-page title="TOPTIPS">
<view class="container">
<view class="doc-title zan-hairline--bottom">TOPTIPS</view>
<view class="zan-btns" style="margin-top: 30vh;"> <view class="zan-btns" style="margin-top: 30vh;">
<button class="zan-btn" bindtap="showTopTips"> <zan-button bind:btnclick="showTopTips">
显示toptips声明式调用 显示toptips声明式调用
</button> </zan-button>
</view> </view>
<view class="zan-btns" style="margin-top: 30px;"> <view class="zan-btns" style="margin-top: 30px;">
<button class="zan-btn" bindtap="showTopTips2"> <zan-button bind:btnclick="showTopTips2">
显示toptips命令式调用 显示toptips命令式调用
</button> </zan-button>
</view> </view>
<view class="zan-btns" style="margin-top: 30px;"> <view class="zan-btns" style="margin-top: 30px;">
<button class="zan-btn" bindtap="showTopTips3"> <zan-button bind:btnclick="showTopTips3">
显示toptips持续一秒 显示toptips持续一秒
</button> </zan-button>
</view> </view>
</view> </doc-page>
<zan-toptips <zan-toptips
id="zan-toptips" id="zan-toptips"
content="{{ content }}" content="{{ content }}"
is-show="{{ $zanui.toptips.show }}" is-show="{{ $zanui.toptips.show }}"
/> />

View File

@ -22,7 +22,10 @@ Component({
return; return;
} }
let checked = !this.data.checked; let checked = !this.data.checked;
this.triggerEvent('change', event, { loading, checked }); this.triggerEvent('change', {
checked,
loading: this.data.loading
});
} }
} }
}); });