Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd31d2e4

Browse files
committed
use of vue class/style passthrough
1 parentd875847 commitd31d2e4

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ see [`dev/`](dev/) for examples.
3030
####Props
3131
| Name| type| default| description|
3232
| ---:| ---| ---| ---|
33+
| class| Array/Object|["tooltip"]| vue-class of the`div`|
34+
| style| Array/Object|[]| vue-class of the`div`|
3335
| offset| Number| 0| offset to the parent|
3436
| anchor| String| "snwe"| direction of opening, viewport dependet. "s" forces to open down. "sn" would try to open down, the up.|
35-
| class| String| tooltip| class of the`div`|
37+
3638
| ignore-parent| Boolean| false| will not set-up`mouseenter`/`mouseleave` listener on parent|
3739
| is-opened| Boolean| false| (two-way) set to open / close|
38-
| transition-in|Fnction| no animation| set animation. Argument: {el,pos,style,cb}|
40+
| transition-in|Function| no animation| set animation. Argument: {el,pos,style,cb}|
3941
| transition-out| Function| no animation| set animation. Argument: {el,style,cb}|
4042
| parent| Element| parentElement| where the tooltip should attach|
4143
| position| String| "parent"| Either "parent" or "body".[Detailed description](#Positioning)|

‎dev/divs.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports =
4242
border-left5pxsolidblack
4343
&.nr4
4444
border-right5pxsolidblack
45-
div>.tooltip
45+
div.div>.tooltip
4646
margin0
4747
padding2px
4848
border1pxdashedred

‎src/tooltip.vue‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// out: ..
22
<template lang="pug">
33
div(
4-
v-bind:style="style"
4+
v-bind:style="computedStyle"
55
style="position:absolute;display:block;box-sizing:border-box"
66
v-if="opened"
77
v-el:tt
8-
v-bind:class="[class]"
8+
v-bind:class="class"
99
)
1010
slot No content
1111
</template>
@@ -16,12 +16,14 @@ module.exports =
1616
mixins:[
1717
require("vue-mixins/getViewportSize")
1818
require("vue-mixins/isOpened")
19+
require("vue-mixins/style")
1920
]
2021
2122
props:
23+
"style":
24+
default:-> []
2225
"class":
23-
type:String
24-
default:"tooltip"
26+
default:-> ["tooltip"]
2527
"anchor":
2628
type:String
2729
default:"snwe"
@@ -32,13 +34,13 @@ module.exports =
3234
type:Function
3335
default: ({el,pos,style,cb})->
3436
for key,valof style
35-
@style[key]= val
37+
@mergeStyle[key]= val
3638
cb()
3739
"transitionOut":
3840
type:Function
3941
default: ({el,style,cb})->
4042
for key,valof style
41-
@style[key]= val
43+
@mergeStyle[key]= val
4244
cb()
4345
"ignoreParent":
4446
type:Boolean
@@ -53,7 +55,7 @@ module.exports =
5355
default:"parent"
5456
5557
data:->
56-
style:
58+
mergeStyle:
5759
opacity:0
5860
left:undefined
5961
top:undefined
@@ -63,7 +65,7 @@ module.exports =
6365
6466
watch:
6567
"parent":"setupParent"
66-
"zIndex": (val)->@style.zIndex= val
68+
"zIndex": (val)->@mergeStyle.zIndex= val
6769
6870
methods:
6971
setupParent: (parent=@parent)->
@@ -134,13 +136,13 @@ module.exports =
134136
isPositioned=false
135137
# set initial style before open
136138
if pos=="w"or pos=="e"
137-
@style.top= top+'px'
138-
@style.left=if isPositionedthen0else@parent.offsetLeft+'px'
139+
@mergeStyle.top= top+'px'
140+
@mergeStyle.left=if isPositionedthen0else@parent.offsetLeft+'px'
139141
else
140-
@style.top=if isPositionedthen0else@parent.offsetTop+'px'
141-
@style.left= left+'px'
142-
@style.height= ttHeight+'px'
143-
@style.width= ttWidth+'px'
142+
@mergeStyle.top=if isPositionedthen0else@parent.offsetTop+'px'
143+
@mergeStyle.left= left+'px'
144+
@mergeStyle.height= ttHeight+'px'
145+
@mergeStyle.width= ttWidth+'px'
144146
# begin opening, wait for initial positioning for transition
145147
@$emit"beforeOpen"
146148
@$nextTick=>
@@ -166,8 +168,8 @@ module.exports =
166168
top= scrollTop+parentPos.top
167169
left= scrollLeft+parentPos.left
168170
@transitionOutel:@$els.tt,style:{opacity:0,top:top+'px',left:left+'px'},cb:=>
169-
@style.width=undefined
170-
@style.height=undefined
171+
@mergeStyle.width=undefined
172+
@mergeStyle.height=undefined
171173
@setClosed()
172174
@$emit"closed"
173175
toggle:->

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp