zanui docs

This commit is contained in:
cookfront 2017-03-17 17:20:56 +08:00
parent 22747de5f9
commit 6726f1e4f1
10 changed files with 98 additions and 17 deletions

View File

@ -29,7 +29,7 @@
export default {
props: {
group: {
type: Array,
type: Object,
default: () => {
return [];
}

View File

@ -4,7 +4,15 @@
</example-block></section></template>
<style>
@component-namespace demo {
@b image-preview {
.zan-button {
margin-left: 15px;
}
}
}
</style>
<script>
import Vue from "vue";import ExampleBlock from "../components/example-block";Vue.component("example-block", ExampleBlock);
import { ImagePreview } from 'src/index';

View File

@ -55,7 +55,10 @@
.zan-popup-4 {
width: 60%;
height: 200px;
box-sizing: border-box;
padding: 20px;
border-radius: 5px;
text-align: center;
}
.zan-button {

View File

@ -1,6 +1,6 @@
<template><section class="demo-switch"><h1 class="demo-title">switch</h1><example-block title="基础用法">
<div class="demo-switch__wrapper">
<zan-switch class="some-customized-class" :checked="switchState" :on-change="updateState"></zan-switch>
<zan-switch class="some-customized-class" :checked="switchState" @change="updateState"></zan-switch>
<div class="demo-switch__text">{{switchStateText}}</div>
</div>
<div class="demo-switch__wrapper">
@ -41,4 +41,22 @@
}
</style>
<script>
import Vue from "vue";import ExampleBlock from "../components/example-block";Vue.component("example-block", ExampleBlock);</script>
import Vue from "vue";import ExampleBlock from "../components/example-block";Vue.component("example-block", ExampleBlock);
export default {
data() {
return {
switchState: true
};
},
computed: {
switchStateText() {
return this.switchState ? ' ON' : 'OFF';
}
},
methods: {
updateState(newState) {
this.switchState = newState;
}
}
};
</script>

View File

@ -38,6 +38,15 @@
</example-block></section></template>
<style>
@component-namespace demo {
@b tab {
.zan-tabs-pane {
background-color: #fff;
padding: 20px;
}
}
}
</style><style>
.page-tab {
padding: 0 15px;
}

View File

@ -1,9 +1,9 @@
<template><section class="demo-toast"><h1 class="demo-title">toast</h1><example-block title="基础用法">
<zan-button @click="showSimpleToast()">普通文字提示</zan-button>
<zan-button @click="showToast('loading')">加载Toast</zan-button>
<zan-button @click="showToast('success')">成功</zan-button>
<zan-button @click="showToast('failure')">失败</zan-button>
<zan-button @click="showSimpleToast">普通文字提示</zan-button>
<zan-button @click="showLoadingToast">加载Toast</zan-button>
<zan-button @click="showSuccessToast">成功</zan-button>
<zan-button @click="showFailToast">失败</zan-button>
<zan-button @click="showCustomizedToast(5000)">倒数5秒</zan-button>
@ -26,11 +26,30 @@ export default {
showSimpleToast() {
Toast('我是提示文案,建议不超过十五字~');
},
showToast(type) {
Toast({
type: type,
message: '文案信息'
})
showLoadingToast() {
Toast.loading();
},
showSuccessToast() {
Toast.success('成功文案');
},
showFailToast() {
Toast.fail('失败文案');
},
showCustomizedToast(duration) {
let leftSec = duration / 1000;
let toast = Toast({
duration: duration + 1000,
type: 'success',
message: leftSec.toString()
});
window.setInterval(() => {
if (leftSec <= 1) {
window.clearInterval();
toast.message = '跳转中...'
return;
}
toast.message = (--leftSec).toString();
}, 1000);
}
}
};

View File

@ -1,3 +1,13 @@
<style>
@component-namespace demo {
@b image-preview {
.zan-button {
margin-left: 15px;
}
}
}
</style>
<script>
import { ImagePreview } from 'src/index';

View File

@ -22,7 +22,10 @@
.zan-popup-4 {
width: 60%;
height: 200px;
box-sizing: border-box;
padding: 20px;
border-radius: 5px;
text-align: center;
}
.zan-button {

View File

@ -1,3 +1,14 @@
<style>
@component-namespace demo {
@b tab {
.zan-tabs-pane {
background-color: #fff;
padding: 20px;
}
}
}
</style>
## Tab 组件
### 基础用法

View File

@ -31,7 +31,7 @@ export default {
```html
<div class="uploader-container">
<zan-uploader @file-readed="logContent">
<zan-icon name="camera"></zan-icon>
<zan-icon name="photograph"></zan-icon>
</zan-uploader>
</div>
```