Commit 46c07066c86d58864fd0ee1e25465c6fd3653027

Authored by 梁灏
1 parent ac50d539

update Poptip style

examples/routers/tooltip.vue
1 1 <template>
2 2 <div>
3   - <Tooltip always placement="top" transfer :content="text" :delay="1000">
  3 + <Tooltip always placement="top" transfer :content="text" :delay="1000" theme="dark">
4 4 <Button @click="disabled = true">延时1秒显示</Button>
5 5 </Tooltip>
6 6 <Tooltip placement="top" transfer :content="text">
7 7 <Button @click="handleChange">change</Button>
8 8 </Tooltip>
9 9 <Button @click="handleChange">change</Button>
  10 + <Poptip title="Title" content="content">
  11 + <Button>Click</Button>
  12 + </Poptip>
10 13 </div>
11 14 </template>
12 15 <script>
... ...
src/components/tooltip/tooltip.vue
... ... @@ -5,7 +5,7 @@
5 5 </div>
6 6 <transition name="fade">
7 7 <div
8   - :class="[prefixCls + '-popper']"
  8 + :class="[prefixCls + '-popper', prefixCls + '-' + theme]"
9 9 ref="popper"
10 10 v-show="!disabled && (visible || always)"
11 11 @mouseenter="handleShowPopper"
... ... @@ -61,6 +61,12 @@
61 61 transfer: {
62 62 type: Boolean,
63 63 default: false
  64 + },
  65 + theme: {
  66 + validator (value) {
  67 + return oneOf(value, ['dark', 'light']);
  68 + },
  69 + default: 'dark'
64 70 }
65 71 },
66 72 data () {
... ...
src/styles/components/poptip.less
1 1 @poptip-prefix-cls: ~"@{css-prefix}poptip";
2 2 @poptip-arrow: ~"@{poptip-prefix-cls}-arrow";
3 3 @poptip-max-width: 250px;
4   -@poptip-arrow-width: 5px;
  4 +@poptip-arrow-width: 7px;
5 5 @poptip-arrow-outer-width: (@poptip-arrow-width + 1);
6 6 @poptip-distance: @poptip-arrow-width - 1 + 4;
7 7 //@poptip-arrow-color: fadein(@border-color-base, 5%);
... ...
src/styles/components/tooltip.less
... ... @@ -3,6 +3,7 @@
3 3 @tooltip-max-width: 250px;
4 4 @tooltip-arrow-width: 5px;
5 5 @tooltip-distance: @tooltip-arrow-width - 1 + 4;
  6 +@poptip-arrow-color: hsla(0,0%,85%,.5);
6 7  
7 8 .@{tooltip-prefix-cls} {
8 9 display: inline-block;
... ... @@ -15,6 +16,10 @@
15 16 &-popper{
16 17 .popper(@tooltip-arrow, @tooltip-arrow-width, @tooltip-distance, @tooltip-bg);
17 18 }
  19 + &-light&-popper{
  20 + .popper(@tooltip-arrow, @tooltip-arrow-width, @tooltip-distance, @poptip-arrow-color);
  21 + }
  22 +
18 23  
19 24 &-inner{
20 25 max-width: @tooltip-max-width;
... ... @@ -29,6 +34,11 @@
29 34 white-space: nowrap;
30 35 }
31 36  
  37 + &-light &-inner{
  38 + background-color: #fff;
  39 + color: @text-color;
  40 + }
  41 +
32 42 &-arrow{
33 43 position: absolute;
34 44 width: 0;
... ...