提交 1c249b97 编写于 作者: D dolymood

format docs

上级 956f0f51
......@@ -6,40 +6,40 @@
- Button type
The default type is `button`, and you can set that to `submit` in form.
The default type is `button`, and you can set that to `submit` in form.
```html
<cube-button>Button</cube-button>
<cube-button type="submit">Submit Button</cube-button>
```
```html
<cube-button>Button</cube-button>
<cube-button type="submit">Submit Button</cube-button>
```
- Button state
Default is normal, can be set to active or disabled state.
Default is normal, can be set to active or disabled state.
```html
<cube-button :active="true">Active Button</cube-button>
<cube-button :disabled="true">Disabled Button</cube-button>
```
```html
<cube-button :active="true">Active Button</cube-button>
<cube-button :disabled="true">Disabled Button</cube-button>
```
- Icon
You can set the class of `icon`.
You can set the class of `icon`.
```html
<cube-button icon="cubeic-right">Button With Icon</cube-button>
```
```html
<cube-button icon="cubeic-right">Button With Icon</cube-button>
```
- Style
You can set attributes like `light`, `inline`, `outline`, and `primary` to change the button's style.
You can set attributes like `light`, `inline`, `outline`, and `primary` to change the button's style.
```html
<cube-button :light="true">Light Button</cube-button>
<cube-button :inline="true">Inline Button</cube-button>
<cube-button :outline="true">Outline Button</cube-button>
<cube-button :primary="true">Primary Button</cube-button>
```
```html
<cube-button :light="true">Light Button</cube-button>
<cube-button :inline="true">Inline Button</cube-button>
<cube-button :outline="true">Outline Button</cube-button>
<cube-button :primary="true">Primary Button</cube-button>
```
### Props configuration
......
......@@ -6,10 +6,10 @@
- Vertical order
Default is vertical order style.
Default is vertical order style.
```html
<cube-checkbox-group v-model="checkList">
```html
<cube-checkbox-group v-model="checkList">
<cube-checkbox label="1">
Checkbox 1
</cube-checkbox>
......@@ -22,24 +22,23 @@ Default is vertical order style.
<cube-checkbox label="4" :disabled="true">
Disabled & Checked Checkbox
</cube-checkbox>
</cube-checkbox-group>
```
</cube-checkbox-group>
```
The value of `checkList` is an array, which represents the set of the values of `label` in selected checkboxs.
The value of `checkList` is an array, which represents the set of the values of `label` in selected checkboxs.
- Horizontal order
You can set `horizontal` to change the style to horizontal order.
You can set `horizontal` to change the style to horizontal order.
```html
<cube-checkbox-group v-model="checkList" :horizontal="true">
```html
<cube-checkbox-group v-model="checkList" :horizontal="true">
<cube-checkbox label="1">1</cube-checkbox>
<cube-checkbox label="2">2</cube-checkbox>
<cube-checkbox label="3" :disabled="true">3</cube-checkbox>
<cube-checkbox label="4" :disabled="true">4</cube-checkbox>
</cube-checkbox-group>
```
</cube-checkbox-group>
```
### Props configuration
......
......@@ -6,43 +6,43 @@
- Basic usage
```html
<cube-checkbox v-model="checked">
```html
<cube-checkbox v-model="checked">
Checkbox
</cube-checkbox>
```
</cube-checkbox>
```
If selected, the value of `checked` is `true`.
If selected, the value of `checked` is `true`.
- Disabled state
```html
<cube-checkbox v-model="checked" :disabled="true">
```html
<cube-checkbox v-model="checked" :disabled="true">
Disabled Checkbox
</cube-checkbox>
```
</cube-checkbox>
```
Set `disabled` to `true` to turn into the disabled state.
Set `disabled` to `true` to turn into the disabled state.
- Position of the checkbox icon
```html
<cube-checkbox v-model="checked" position="right">
```html
<cube-checkbox v-model="checked" position="right">
Position Checkbox
</cube-checkbox>
```
</cube-checkbox>
```
If setting `position` to `'right'`, the position of the checkbox's icon is on the right.
If setting `position` to `'right'`, the position of the checkbox's icon is on the right.
- Change the value of model
```html
<cube-checkbox v-model="checked" label="labelValue">
```html
<cube-checkbox v-model="checked" label="labelValue">
Set label Checkbox
</cube-checkbox>
```
</cube-checkbox>
```
If `label` is setted, and when the checkbox is selected, the value of `checked` is `'labelValue'`. When not selected, the value is `false`; Therefore, in circumstances of single checkbox, better not set `label`.
If `label` is setted, and when the checkbox is selected, the value of `checked` is `'labelValue'`. When not selected, the value is `false`; Therefore, in circumstances of single checkbox, better not set `label`.
### Props configuration
......
......@@ -20,17 +20,17 @@ This module exports a function called `createAPI` with which you can invoke the
- Example:
First we create Hello.vue component:
First we create Hello.vue component:
```html
<template>
```html
<template>
<div @click="clickHandler">
{{content}}
<slot name="other"></slot>
</div>
</template>
</template>
<script type="text/ecmascript-6">
<script type="text/ecmascript-6">
export default {
name: 'hello',
props: {
......@@ -45,12 +45,12 @@ First we create Hello.vue component:
}
}
}
</script>
```
</script>
```
Then we make Hello.vue to an API style component by calling the `createAPI` method.
Then we make Hello.vue to an API style component by calling the `createAPI` method.
```js
```js
import Vue from 'vue'
import Hello from './Hello.vue'
......@@ -111,5 +111,5 @@ Then we make Hello.vue to an API style component by calling the `createAPI` meth
}
}
})
```
In this example, we create a component `Hello` which needs to be invoked in api form and we invoke it in another component.The focus is what `showHello()` does: invoking method `this.$createHello(config, renderFn)` to instantiate `Hello`.
```
In this example, we create a component `Hello` which needs to be invoked in api form and we invoke it in another component.The focus is what `showHello()` does: invoking method `this.$createHello(config, renderFn)` to instantiate `Hello`.
......@@ -6,17 +6,17 @@
- Basic usage
Construct data like `cityData` in the example below and pass it into `data` in `cube-index-list` component.
Construct data like `cityData` in the example below and pass it into `data` in `cube-index-list` component.
```html
<cube-index-list
```html
<cube-index-list
:data="cityData"
:title="title"
@select="selectItem"
@title-click="clickTitle"></cube-index-list>
```
```javascript
const cityData = [
```
```javascript
const cityData = [
{
"name": "★Hot City",
"items": [
......@@ -43,9 +43,9 @@ const cityData = [
}
]
}
]
]
export default {
export default {
data() {
return {
title: 'Current City: BEIJING',
......@@ -60,8 +60,8 @@ export default {
console.log(title)
}
}
}
```
}
```
### Props configuration
......
......@@ -6,13 +6,13 @@
- The size of icon
Default is `24px` and can be configured by setting `size`.
Default is `24px` and can be configured by setting `size`.
```html
<cube-loading></cube-loading>
<cube-loading :size="28"></cube-loading>
<cube-loading :size="34"></cube-loading>
```
```html
<cube-loading></cube-loading>
<cube-loading :size="28"></cube-loading>
<cube-loading :size="34"></cube-loading>
```
### Props configuration
......
......@@ -6,12 +6,12 @@
- Basic usage
```html
<cube-button @click="showPicker">Picker</cube-button>
```
```js
const col1Data = [{ text: '剧毒', value: '剧毒'}, { text: '蚂蚁', value: '蚂蚁' }, { text: '幽鬼', value: '幽鬼' }]
export default {
```html
<cube-button @click="showPicker">Picker</cube-button>
```
```js
const col1Data = [{ text: '剧毒', value: '剧毒'}, { text: '蚂蚁', value: '蚂蚁' }, { text: '幽鬼', value: '幽鬼' }]
export default {
mounted () {
this.picker = this.$createPicker({
title: 'Picker selectors - single column',
......@@ -37,20 +37,20 @@ export default {
this.picker.show()
}
}
}
```
}
```
- Multi-column selectors
```html
<cube-button @click="showPicker">Picker - multiple Columns</cube-button>
```
```js
const col1Data = [{ text: '剧毒', value: '剧毒'}, { text: '蚂蚁', value: '蚂蚁' }, { text: '幽鬼', value: '幽鬼' }]
```html
<cube-button @click="showPicker">Picker - multiple Columns</cube-button>
```
```js
const col1Data = [{ text: '剧毒', value: '剧毒'}, { text: '蚂蚁', value: '蚂蚁' }, { text: '幽鬼', value: '幽鬼' }]
const col2Data = [{ text: '输出', value: '输出' }, { text: '控制', value: '控制' }, { text: '核心', value: '核心'
}, { text: '爆发', value: '爆发' }, { text: '辅助', value: '辅助' }, { text: '打野', value: '打野' }, { text: '逃生', value: '逃生' }, { text: '先手', value: '先手' }]
}, { text: '爆发', value: '爆发' }, { text: '辅助', value: '辅助' }, { text: '打野', value: '打野' }, { text: '逃生', value: '逃生' }, { text: '先手', value: '先手' }]
const col3Data = [{ text: '梅肯', value: '梅肯'}, { text: '秘法鞋', value: '秘法鞋' }, { text: '假腿', value: '假腿' }, { text: '飞鞋', value: '飞鞋' }, { text: '辉耀', value: '辉耀' }, { text: '金箍棒', value: '金箍棒' }]
export default {
export default {
mounted () {
this.picker = this.$createPicker({
title: 'Picker selectors - multiple columns',
......@@ -62,20 +62,20 @@ export default {
this.picker.show()
}
}
}
```
}
```
`data` receives an array, whose length determines the columns of `picker`.
`data` receives an array, whose length determines the columns of `picker`.
- Linkage selectors
```html
<cube-button @click="showPicker">Picker - linkage</cube-button>
```
```js
import { provinceList, cityList, areaList } from '../data/area'
```html
<cube-button @click="showPicker">Picker - linkage</cube-button>
```
```js
import { provinceList, cityList, areaList } from '../data/area'
export default {
export default {
data () {
return {
tempIndex: [0, 0, 0]
......@@ -131,21 +131,21 @@ export default {
this.picker.show()
}
}
}
```
}
```
By monitoring the `change` event triggered by each roller and invoke `setData` method to dynamicly set values of associated rollers to accomplish linkage selectors.
By monitoring the `change` event triggered by each roller and invoke `setData` method to dynamicly set values of associated rollers to accomplish linkage selectors.
- Instance method `setData`
```html
<cube-button @click="showPicker">Picker - setData</cube-button>
```
```js
const col1Data = [{ text: '剧毒', value: '剧毒'}, { text: '蚂蚁', value: '蚂蚁' }, { text: '幽鬼', value: '幽鬼' }]
const col2Data = [{ text: '梅肯', value: '梅肯'}, { text: '秘法鞋', value: '秘法鞋' }, { text: '假腿', value: '假腿' }, { text: '飞鞋', value: '飞鞋' }, { text: '辉耀', value: '辉耀' }, { text: '金箍棒', value: '金箍棒' }]
const col3Data = [{ text: '输出', value: '输出'}, { text: '控制', value: '控制' }, { text: '核心', value: '核心' }, { text: '爆发', value: '爆发'}, { text: '辅助', value: '辅助' }]
export default {
```html
<cube-button @click="showPicker">Picker - setData</cube-button>
```
```js
const col1Data = [{ text: '剧毒', value: '剧毒'}, { text: '蚂蚁', value: '蚂蚁' }, { text: '幽鬼', value: '幽鬼' }]
const col2Data = [{ text: '梅肯', value: '梅肯'}, { text: '秘法鞋', value: '秘法鞋' }, { text: '假腿', value: '假腿' }, { text: '飞鞋', value: '飞鞋' }, { text: '辉耀', value: '辉耀' }, { text: '金箍棒', value: '金箍棒' }]
const col3Data = [{ text: '输出', value: '输出'}, { text: '控制', value: '控制' }, { text: '核心', value: '核心' }, { text: '爆发', value: '爆发'}, { text: '辅助', value: '辅助' }]
export default {
mounted () {
this.picker = this.$createPicker({
title: 'Picker-setData',
......@@ -171,10 +171,10 @@ export default {
this.picker.show()
}
}
}
```
}
```
Instance method `setData` accepts two parameters, both of whom are arrays. The first is data that the roller displays and the second is indexs of selected values.
Instance method `setData` accepts two parameters, both of whom are arrays. The first is data that the roller displays and the second is indexs of selected values.
### Props configuration
......
......@@ -8,19 +8,19 @@ All of the built-in popup type components are implemented based on this componen
- Basic usage
```html
<cube-popup type="my-popup" ref="myPopup">
```html
<cube-popup type="my-popup" ref="myPopup">
My Popup Content 1
</cube-popup>
<cube-button @click="showPopup('myPopup')">
</cube-popup>
<cube-button @click="showPopup('myPopup')">
Show Popup
</cube-button>
```
</cube-button>
```
Specifying `type` will help control class according to the type. In the example above, `cube-my-popup` will be added to the classList of the root element.
Specifying `type` will help control class according to the type. In the example above, `cube-my-popup` will be added to the classList of the root element.
```js
export default {
```js
export default {
methods: {
showPopup(refId) {
const component = this.$refs[refId]
......@@ -30,60 +30,61 @@ export default {
}, 1000)
}
}
}
```
}
```
The component is hidden by default and won't show up unless invoking the `show()` method of the instance of the component. And of course, invoking the `hide()` method of the instance of the component will hide itself. That's what `showPopup()` does in the example above (first show and hide in one second).
The component is hidden by default and won't show up unless invoking the `show()` method of the instance of the component. And of course, invoking the `hide()` method of the instance of the component will hide itself. That's what `showPopup()` does in the example above (first show and hide in one second).
- Without background layer
```html
<cube-popup type="my-popup" :mask="false" ref="myPopup2">
```html
<cube-popup type="my-popup" :mask="false" ref="myPopup2">
My Popup Content 2
</cube-popup>
<cube-button @click="showPopup('myPopup2')">
</cube-popup>
<cube-button @click="showPopup('myPopup2')">
Show Popup - no mask
</cube-button>
```
</cube-button>
```
Setting `mask` to `false` and the background layer is hidden.
Setting `mask` to `false` and the background layer is hidden.
- Show the HTML content
```html
<cube-popup
```html
<cube-popup
type="my-popup"
:mask="false"
content="<i>My Popup Content 3</i>"
ref="myPopup3" />
<cube-button @click="showPopup('myPopup3')">
<cube-button @click="showPopup('myPopup3')">
Show Popup - with content
</cube-button>
```
</cube-button>
```
You only need to pass the HTML fragment on to `content`.
You only need to pass the HTML fragment on to `content`.
- Setting to bottom
```html
<cube-popup type="my-popup" :center="false" ref="myPopup4">My Popup Content 4</cube-popup>
<cube-button @click="showPopup('myPopup4')">
```html
<cube-popup type="my-popup" :center="false" ref="myPopup4">My Popup Content 4</cube-popup>
<cube-button @click="showPopup('myPopup4')">
Show Popup - bottom
</cube-button>
```
</cube-button>
```
Considering that in mobile secnes, popup is in center or bottom most of the time (covered in horizontal direction when setted to bottom). So if setting `center` to `false`, you'll set the component to bottom.
Considering that in mobile secnes, popup is in center or bottom most of the time (covered in horizontal direction when setted to bottom). So if setting `center` to `false`, you'll set the component to bottom.
- Upper layer encapsulation
```html
<template>
```html
<template>
<cube-popup type="extend-popup" ref="popup">
<div class="cube-extend-popup-content" @click="hide">
<slot>{{content}}</slot>
</div>
</cube-popup>
</template>
<script type="text/ecmascript-6">
</template>
<script type="text/ecmascript-6">
const COMPONENT_NAME = 'cube-extend-popup'
export default {
name: COMPONENT_NAME,
......@@ -102,24 +103,24 @@ Considering that in mobile secnes, popup is in center or bottom most of the time
}
}
}
</script>
<style lang="stylus" rel="stylesheet/stylus">
</script>
<style lang="stylus" rel="stylesheet/stylus">
.cube-extend-popup
.cube-extend-popup-content
padding: 20px
color: #fff
background-color: rgba(0, 0, 0, .8)
</style>
```
</style>
```
An upper layer encapsulated CubeExtendPopup component with some styles is implemented. It supports passing the content on, has default slot and can be hidden if clicking the content. You can use it in this way (need to be registers globally or partially):
An upper layer encapsulated CubeExtendPopup component with some styles is implemented. It supports passing the content on, has default slot and can be hidden if clicking the content. You can use it in this way (need to be registers globally or partially):
```html
<cube-extend-popup content="lala" ref="extendPopup"></cube-extend-popup>
<cube-button @click="$refs.extendPopup.show()">
```html
<cube-extend-popup content="lala" ref="extendPopup"></cube-extend-popup>
<cube-button @click="$refs.extendPopup.show()">
Show Extend Popup
</cube-button>
```
</cube-button>
```
### Props configuration
......
......@@ -6,26 +6,26 @@
- Basic usage
By setting `data` to an array, you can generate the list which can scrolls elegantly in the container.
By setting `data` to an array, you can generate the list which can scrolls elegantly in the container.
```html
<div class="scroll-wrapper">
```html
<div class="scroll-wrapper">
<cube-scroll :data="items"></cube-scroll>
</div>
```
</div>
```
- Scroll bar
Default is without scroll bar. You can set it to fade-in-fade-out or always-show style.
Default is without scroll bar. You can set it to fade-in-fade-out or always-show style.
```html
<!-- fade-in-fade-out style -->
<cube-scroll :data="items" :scrollbar="true"></cube-scroll>
<!-- always-show style -->
<cube-scroll :data="items" :scrollbar="scrollbar"></cube-scroll>
```
```javascript
export default {
```html
<!-- fade-in-fade-out style -->
<cube-scroll :data="items" :scrollbar="true"></cube-scroll>
<!-- always-show style -->
<cube-scroll :data="items" :scrollbar="scrollbar"></cube-scroll>
```
```javascript
export default {
data() {
return {
items: [1, 2, 3, 4, 5],
......@@ -34,29 +34,29 @@ export default {
}
}
}
}
```
}
```
- Pull down to refresh
There is no pull-down-to-refresh function by default. Configuring `pull-down-refresh` can turn on the dispatching of the event `pulling-down` and the animation of pulling down. You can listen to `pulling-down` event to update data.
There is no pull-down-to-refresh function by default. Configuring `pull-down-refresh` can turn on the dispatching of the event `pulling-down` and the animation of pulling down. You can listen to `pulling-down` event to update data.
```html
<!-- turn on the pull-down-to-refresh function and use default configuration -->
<cube-scroll
```html
<!-- turn on the pull-down-to-refresh function and use default configuration -->
<cube-scroll
ref="scroll"
:data="items"
:pull-down-refresh="true"
@pulling-down="onPullingDown"></cube-scroll>
<!-- turn on the pull-down-to-refresh function and use custom configuration -->
<cube-scroll
<!-- turn on the pull-down-to-refresh function and use custom configuration -->
<cube-scroll
ref="scroll"
:data="items"
:pull-down-refresh="pullDownRefresh"
@pulling-down="onPullingDown"></cube-scroll>
```
```javascript
export default {
```
```javascript
export default {
data() {
return {
items: [1, 2, 3, 4, 5],
......@@ -81,30 +81,29 @@ export default {
}, 1000)
}
}
}
```
}
```
- Pulling up to load
There is no pull-up-to-load function by default. Configuring `pull-up-load` can turn on the dispatching of the event `pulling-up` and the animation of pulling up. You can listen to `pulling-up` event to update data.
There is no pull-up-to-load function by default. Configuring `pull-up-load` can turn on the dispatching of the event `pulling-up` and the animation of pulling up. You can listen to `pulling-up` event to update data.
```html
<!-- turn on the pull-up-to-load function and use default configuration -->
<cube-scroll
```html
<!-- turn on the pull-up-to-load function and use default configuration -->
<cube-scroll
ref="scroll"
:data="items"
:pull-up-load="true"
@pulling-up="onPullingUp"></cube-scroll>
<!-- turn on the pull-up-to-load function and use custom configuration -->
<cube-scroll
<!-- turn on the pull-up-to-load function and use custom configuration -->
<cube-scroll
ref="scroll"
:data="items"
:pull-up-load="pullUpLoad"
@pulling-up="onPullingUp"></cube-scroll>
```
```javascript
export default {
```
```javascript
export default {
data() {
return {
items: [1, 2, 3, 4, 5],
......@@ -140,15 +139,15 @@ export default {
}, 1000)
}
}
}
```
}
```
- Customize the animation of pulling down refreshing and pulling up loading
If you don't like the built-in slots of pulling down refreshing and pulling up loading, you can use [scoped slots](https://vuejs.org/v2/guide/components.html#Scoped-Slots) to customize animation. The example below uses scoped slots to customize animation of pulling down refreshing, while pulling up loading keeps default built-in animation.
If you don't like the built-in slots of pulling down refreshing and pulling up loading, you can use [scoped slots](https://vuejs.org/v2/guide/components.html#Scoped-Slots) to customize animation. The example below uses scoped slots to customize animation of pulling down refreshing, while pulling up loading keeps default built-in animation.
```html
<cube-scroll
```html
<cube-scroll
ref="scroll"
:data="items"
:pull-down-refresh="pullDownRefresh"
......@@ -174,16 +173,15 @@ If you don't like the built-in slots of pulling down refreshing and pulling up l
</div>
</div>
</template>
</cube-scroll>
```
With the parameters that scoped slots provide, you can control the process of animation according to the change of the state. Detailed scope parameters and their meaning are shown below in 'Slots'.
</cube-scroll>
```
With the parameters that scoped slots provide, you can control the process of animation according to the change of the state. Detailed scope parameters and their meaning are shown below in 'Slots'.
### Props configuration
| Attribute | Description | Type | Accepted Values | Default |
| ------------------ | ---------------------------------------- | -------------- | ------------------------ | ---------- |
| - | - | - | - | - |
| data | data used for list rendering | Array | - | [] |
| direction | scrolling direction | String | 'vertical', 'horizontal' | 'vertical' |
| scrollbar | configuration for scroll bar | Boolean/Object | - | false |
......@@ -196,13 +194,13 @@ With the parameters that scoped slots provide, you can control the process of an
- `scrollbar` sub configuration
| Attribute | Description | Type | Accepted Values | Default |
| --------- | -------------------------------------- | ------- | --------------- | ------- |
| - | - | - | - | - |
| fade | whether to have fade-in-fade-out style | Boolean | true/false | false |
- `pullDownRefresh` sub configuration
| Attribute | Description | Type | Accepted Values | Default |
| --------- | ---------------------------------------- | ------ | --------------- | ----------------- |
| - | - | - | - | - |
| threshold | the threshold of distance that pulling down for refreshing | Number | - | 90 |
| stop | the position where rebounding stays | Number | - | 40 |
| txt | the text shown when refreshing successfully | String | - | 'Refresh success' |
......@@ -210,21 +208,21 @@ With the parameters that scoped slots provide, you can control the process of an
- `pullUpLoad` sub configuration
| Attribute | Description | Type | Accepted Values | Default |
| --------- | ---------------------------------------- | ------ | --------------- | ---------------------------------------- |
| - | - | - | - | - |
| threshold | the threshold of distance that pulling up for loading | Number | - | 0 |
| txt | the text shown when pulling up loading | Object | - | { more: 'Load more', noMore: 'No more data' } |
### Slot
| Name | Description | Scope Parameters |
| -------- | ---------------------------------------- | ---------------------------------------- |
| - | - | - |
| pulldown | located above the list and shown when pulling down refreshing | pullDownRefresh: whether to turn on pulling-down-refreshing function<br>pullDownStyle: the style of showing and fading<br>beforePullDown: whether in pulling down operation<br>isPullingDown: whether in the process of pulling in data<br>bubbleY: the distance of pulling down currently - 50 |
| pullup | located below the list and shown when pulling up loading | pullUpLoad: whether to turn on pulling-up-loading function<br>isPullUpLoad: whether the data is being loaded |
### Events
| Event Name | Description | Parameters |
| ------------------- | ---------------------------------------- | ---------------------------------------- |
| - | - | - |
| click | triggers when clicking the list item | item - the data of the list item |
| scroll | triggers according to the value of probeType, if listenScroll is true | Object {x, y} - real-time scrolling coordinates |
| before-scroll-start | triggers before scrolling start, if listenBeforeScroll | - |
......
......@@ -91,7 +91,7 @@
### Props configuration
| Attribute | Description | Type | Accepted Values | Default |
| --------- | ------------------------------------ | ------- | --------------- | ------- |
| - | - | - | - | - |
| loop | whether to loop play | Boolean | true/false | true |
| autoPlay | whether to play automatically | Boolean | true/false | true |
| interval | interval of play | Number | - | 4000 |
......@@ -101,5 +101,5 @@
### 事件
| Event Name | Description | Parameters |
| ---------- | ----------------------------------- | ---------------------- |
| - | - | - |
| change | triggers when current slide changes | index of current slide |
......@@ -6,12 +6,12 @@
- Basic usage
```html
<cube-button @click="showTimePicker">TimePicker</cube-button>
```
```html
<cube-button @click="showTimePicker">TimePicker</cube-button>
```
```js
export default {
```js
export default {
methods: {
showTimePicker () {
this.$createTimePicker({
......@@ -36,19 +36,19 @@ export default {
}).show()
}
}
}
```
}
```
`showNow` is uesed to control whether the time "now" is displayed. `minuteStep` is used to control the step of the minute. `delay` represents the time that postponed backwards from now, which determines the minimal optional time.
`showNow` is uesed to control whether the time "now" is displayed. `minuteStep` is used to control the step of the minute. `delay` represents the time that postponed backwards from now, which determines the minimal optional time.
- Configuration of date options
```html
<cube-button @click="showTimePicker">TimePicker - day options</cube-button>
```
```html
<cube-button @click="showTimePicker">TimePicker - day options</cube-button>
```
```js
export default {
```js
export default {
methods: {
showTimePicker () {
this.$createTimePicker({
......@@ -81,23 +81,23 @@ export default {
}).show()
}
}
}
```
}
```
`len` attribute in `day` can set the length of date displayed in the first column.
`len` attribute in `day` can set the length of date displayed in the first column.
`filter` attribute can set the text of the date displayed in the first column.
`filter` attribute can set the text of the date displayed in the first column.
`format` attribute can set the text in `M year d day` format when the `len` is greater than the length of `filter` array.
`format` attribute can set the text in `M year d day` format when the `len` is greater than the length of `filter` array.
- Set time manually
```html
<cube-button @click="showTimePicker">TimePicker - setTime(next hour)</cube-button>
```
```html
<cube-button @click="showTimePicker">TimePicker - setTime(next hour)</cube-button>
```
```js
export default {
```js
export default {
methods: {
const time = new Date().valueOf() + 1 * 60 * 60 * 1000
showTimePicker () {
......@@ -131,10 +131,10 @@ export default {
timePicker.show()
}
}
}
```
}
```
`timePicker` instance exports `setTime` methos to set time manually with the time stamp as time format. When the time stamp is lower than current time stamp, `timePicker` displays current time by default.
`timePicker` instance exports `setTime` methos to set time manually with the time stamp as time format. When the time stamp is lower than current time stamp, `timePicker` displays current time by default.
### Props configuration
......
......@@ -6,29 +6,29 @@
- Basic usage
By adding `ref` to `Tip`, you can get the reference to the component and invoke `show` or `hide` methods which are exposed by `Tip` to control the show or hide state of the component.
By adding `ref` to `Tip`, you can get the reference to the component and invoke `show` or `hide` methods which are exposed by `Tip` to control the show or hide state of the component.
```html
<div class="tip" @click="showTip">
```html
<div class="tip" @click="showTip">
<cube-tip ref="tip"></cube-tip>
</div>
```
```javascript
export default {
</div>
```
```javascript
export default {
methods: {
showTip () {
this.$refs.tip.show()
}
}
}
```
}
```
- The position of the small triangle and the bubble box
You can configure the direction of the small triangle by `direction` and configure the position of the bubble box by `style`. Normally, the direction of the small triangle is opposite to the position of the bubble box.
You can configure the direction of the small triangle by `direction` and configure the position of the bubble box by `style`. Normally, the direction of the small triangle is opposite to the position of the bubble box.
```html
<p class="tip-eg">
```html
<p class="tip-eg">
<span>CubeUI</span>
<cube-tip
ref="tip"
......@@ -39,14 +39,14 @@ You can configure the direction of the small triangle by `direction` and configu
<div>Awesome!</div>
</cube-tip>
</p>
</div>
<cube-button @click="showTip('bottom')">top</cube-button>
<cube-button @click="showTip('top')">bottom</cube-button>
<cube-button @click="showTip('right')">left</cube-button>
<cube-button @click="showTip('left')">right</cube-button>
```
```javascript
export default {
</div>
<cube-button @click="showTip('bottom')">top</cube-button>
<cube-button @click="showTip('top')">bottom</cube-button>
<cube-button @click="showTip('right')">left</cube-button>
<cube-button @click="showTip('left')">right</cube-button>
```
```javascript
export default {
data() {
return {
direction: '',
......@@ -80,8 +80,8 @@ export default {
console.log('click tip area')
}
}
}
```
}
```
### Props configuration
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册