ant-design-vue/components/tooltip/demo/index.vue

68 lines
1.5 KiB
Vue
Raw Normal View History

2017-11-03 10:06:00 +00:00
<template>
<div>
<tool-tip
2017-11-03 12:53:01 +00:00
placement="top"
2017-11-03 10:06:00 +00:00
:title="showText">
<h1 @click="boom" style="display: inline-block">This is just a test, put your cursor here</h1>
</tool-tip>
2017-11-03 12:53:01 +00:00
<ant-button>{{showText}}</ant-button>
2017-11-03 10:06:00 +00:00
<div class="box">
<table>
<tr v-for="(tr, index) in table" :key="index">
<td v-for="(td, i) in tr" :key="i">
<tool-tip v-if="td" :placement="td" :title="td"><AntButton type="primary">{{td}}</AntButton></tool-tip>
</td>
</tr>
</table>
</div>
</div>
</template>
<script>
2017-11-03 12:53:01 +00:00
import { ToolTip, Button } from 'antd'
import 'antd/button/style'
2017-11-03 10:06:00 +00:00
export default {
name: 'tooltip-basic',
data() {
return {
show: true,
showText: '你好啊233',
table: [
['', 'topLeft', 'top', 'topRight', ''],
['leftTop', '', '', '', 'rightTop'],
['left', '', '', '', 'right'],
['leftBottom', '', '', '', 'rightBottom'],
['', 'bottomLeft', 'bottom', 'bottomRight', ''],
]
}
},
methods: {
boom() {
2017-11-03 12:53:01 +00:00
if (this.showText.length % 20) {
this.showText += '3'
} else {
this.showText += ' '
}
2017-11-03 10:06:00 +00:00
}
},
components: {
ToolTip,
AntButton: Button,
}
}
</script>
<style scoped lang="less">
.box {
margin: 100px;
}
table {
td {
padding: 20px;
}
p {
text-align: center;
vertical-align: middle;
}
}
</style>