cell component add click event

This commit is contained in:
cookfront 2017-02-14 15:22:45 +08:00
parent f55d3cb7c4
commit 975c39029b
5 changed files with 39 additions and 3 deletions

View File

@ -6,6 +6,16 @@
}
</style>
<script>
export default {
methods: {
handleClick() {
console.log('cell click');
}
}
};
</script>
## Cell 组件
### 基础用法
@ -24,7 +34,7 @@
:::demo 传入`label`属性,属性值为描述信息的值。
```html
<o2-cell-group>
<o2-cell title="单元格1" label="描述信息" is-link></o2-cell>
<o2-cell title="单元格1" label="描述信息" is-link url="javascript:void(0)" @click="handleClick"></o2-cell>
<o2-cell title="单元格2" label="描述信息"></o2-cell>
</o2-cell-group>
```

View File

@ -1 +1,15 @@
## Field组件
表单中`input``textarea`的输入框。
### API
| 参数 | 说明 | 类型 | 默认值 | 可选值 |
|-----------|-----------|-----------|-------------|-------------|
| type | 输入框类型 | string | text | text, number, email, url, tel, date, datetime, password, textarea |
| placeholder | 输入框placeholder | string | '' | |
| value | 输入框的值 | string | '' | |
| label | 输入框标签 | string | '' | |
| disabled | 是否禁用输入框 | boolean | false | |
| readonly | 输入框是否只读 | boolean | false | |

View File

@ -1,5 +1,5 @@
<template>
<a class="o2-cell" :href="url">
<a class="o2-cell" :href="url" @click="handleClick">
<div class="o2-cell-title">
<slot name="icon">
<i v-if="icon" class="zui-icon" :class="'zui-icon-' + icon"></i>
@ -29,6 +29,12 @@ export default {
url: String,
label: String,
isLink: Boolean
},
methods: {
handleClick() {
this.$emit('click');
}
}
};
</script>

View File

@ -5,7 +5,13 @@
</template>
<script>
import O2Cell from 'packages/cell';
export default {
name: 'o2-filed'
name: 'o2-filed',
components: {
O2Cell
}
};
</script>

View File