add button

This commit is contained in:
niunai
2017-02-06 10:30:43 +08:00
parent 347dc1751c
commit 4562ca8b19
23 changed files with 616 additions and 117 deletions

57
docs/examples/button.md Normal file
View File

@@ -0,0 +1,57 @@
<style lang="css">
@component-namespace page {
@component button {
padding: 0 15px 15px;
@descendent group {
margin-bottom: 15px;
& > * {
margin-bottom: 15px;
}
}
}
}
</style>
## Button组件
### 基础用法
:::demo 样例代码
```html
<div class="page-button">
<h1 class="page-title">Button</h1>
<div class="page-button-group">
<o2-button size="large">default</o2-button>
<o2-button size="large" type="primary">primary</o2-button>
<o2-button size="large" type="danger">danger</o2-button>
</div>
<div class="page-button-group">
<o2-button>default</o2-button>
<o2-button type="primary">primary</o2-button>
<o2-button type="danger">danger</o2-button>
</div>
<div class="page-button-group">
<o2-button size="small">default</o2-button>
<o2-button size="small" type="primary">primary</o2-button>
<o2-button size="small" type="danger">danger</o2-button>
</div>
<div class="page-button-group">
<o2-button disabled size="large">default</o2-button>
<o2-button disabled size="large" type="primary">primary</o2-button>
<o2-button disabled size="large" type="danger" class="aaa">danger</o2-button>
</div>
</div>
```
:::
### API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|-----------|-----------|-----------|-------------|-------------|
| className | 自定义额外类名 | string | '' | '' |

View File

@@ -2,7 +2,7 @@
export default {
data() {
return {
author: 'test'
author: 'pangxie'
};
}
};
@@ -16,7 +16,7 @@ author设置为test
:::demo 样例代码
```html
<sample author="author"></sample>
<sample :author="author"></sample>
```
:::

View File

@@ -12,24 +12,30 @@ Vue.use(VueRouter);
Vue.component('demo-block', demoBlock);
Vue.component('side-nav', SideNav);
// init components
// for (let i in Oxygen) {
// let module = Oxygen[i];
// if (!module.ignoreInit) {
// Vue.component(module.name, module);
// }
// }
const router = new VueRouter({
mode: 'hash',
base: __dirname,
routes
});
// router.beforeEach(function(transition) {
// window.scrollTo(0, 0);
// transition.next();
// });
let indexScrollTop = 0;
router.beforeEach((route, redirect, next) => {
if (route.path !== '/') {
indexScrollTop = document.body.scrollTop;
}
document.title = route.meta.title || document.title;
next();
});
router.afterEach(route => {
if (route.path !== '/') {
document.body.scrollTop = 0;
} else {
Vue.nextTick(() => {
document.body.scrollTop = indexScrollTop;
});
}
});
new Vue({ // eslint-disable-line
render: h => h(App),

View File

@@ -9,6 +9,10 @@
{
"path": "/sample",
"title": "Sample组件"
},
{
"path": "/button",
"title": "Button组件"
}
]
}