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

98 lines
2.4 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-06 04:13:36 +00:00
:title="showText"
:autoAdjustOverflow="autoAdjustOverflow"
>
<h1 @click="boom" class="test">撞到边缘翻转位置 & 点击更新</h1>
2017-11-03 10:06:00 +00:00
</tool-tip>
2017-11-06 04:13:36 +00:00
<ant-button @click="reverse" type="primary">{{autoAdjustOverflow ? '启用' : '关闭'}}自动调整中</ant-button>
2017-11-03 10:06:00 +00:00
<div class="box">
2017-11-06 04:13:36 +00:00
<h2>切换arrowPointAtCenter模式</h2>
<ant-button @click="change">{{arrowPointAtCenter}}</ant-button>
2017-11-03 10:06:00 +00:00
<table>
<tr v-for="(tr, index) in table" :key="index">
<td v-for="(td, i) in tr" :key="i">
2017-11-06 04:13:36 +00:00
<tool-tip
v-if="td"
:placement="td"
:title="td"
:arrowPointAtCenter="arrowPointAtCenter"
>
<AntButton type="primary">{{td}}</AntButton>
</tool-tip>
2017-11-03 10:06:00 +00:00
</td>
</tr>
</table>
</div>
2017-11-06 04:13:36 +00:00
<div>
<p>
<tool-tip :arrowPointAtCenter="true" title="Consider using the NamedModulesPlugin for module names." placement="topLeft">
<ant-button>arrowPointAtCenter arrowPointAtCenter arrowPointAtCenter</ant-button>
</tool-tip>
</p>
</div>
2017-11-03 10:06:00 +00:00
</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', ''],
2017-11-06 04:13:36 +00:00
],
arrowPointAtCenter: false,
autoAdjustOverflow: true,
2017-11-03 10:06:00 +00:00
}
},
methods: {
boom() {
2017-11-03 12:53:01 +00:00
if (this.showText.length % 20) {
this.showText += '3'
} else {
this.showText += ' '
}
2017-11-06 04:13:36 +00:00
},
change() {
this.arrowPointAtCenter = !this.arrowPointAtCenter
},
reverse() {
this.autoAdjustOverflow = !this.autoAdjustOverflow
2017-11-03 10:06:00 +00:00
}
},
components: {
ToolTip,
AntButton: Button,
}
}
</script>
<style scoped lang="less">
2017-11-06 04:13:36 +00:00
.test {
margin: 20px;
display: inline-block;
}
2017-11-03 10:06:00 +00:00
.box {
margin: 100px;
}
table {
td {
padding: 20px;
}
p {
text-align: center;
vertical-align: middle;
}
}
</style>