This repository was archived by the owner on May 28, 2024. It is now read-only.
File tree 7 files changed +33
-32
lines changed
7 files changed +33
-32
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ Messagist
9
9
10
10
### Using Messagist
11
11
12
- It's quite simple. As a usual plugin just let Vue know about it's existance :
12
+ It's quite simple. Messeagist is prepared as a Vue component object, so the easiest is to use it as a global component :
13
13
14
14
``` js
15
15
import Messagist from ' vue-messagist'
16
16
17
- Vue .use ( Messagist)
17
+ Vue .component ( ' messagist ' , Messagist)
18
18
```
19
19
20
20
This makes a ` messagist ` component available, which has one mandatory ` messages ` property.
@@ -80,7 +80,7 @@ and the JS on the page could look like this.
80
80
``` js
81
81
import Messagist from ' vue-messagist'
82
82
83
- Vue .use ( Messagist)
83
+ Vue .component ( ' messagist ' , Messagist)
84
84
85
85
const messages = {... } // the message example from above
86
86
Original file line number Diff line number Diff line change 57
57
</ div >
58
58
< script src ="/dist/messagist.js "> </ script >
59
59
< script >
60
- Vue . use ( Messagist )
60
+ console . log ( Messagist )
61
+
62
+ Vue . component ( 'messagist' , Messagist )
61
63
62
64
conversation = {
63
65
init : {
Original file line number Diff line number Diff line change 11
11
</ div >
12
12
< script src ="/dist/messagist.js "> </ script >
13
13
< script >
14
- Vue . use ( Messagist )
14
+ Vue . component ( 'messagist' , Messagist )
15
15
16
16
new Vue ( {
17
17
el : '#app' ,
Original file line number Diff line number Diff line change 1
1
<template lang="html">
2
2
<a
3
- class =" choice "
3
+ class =" messagist__choices-list-item "
4
4
:href =" primaryKey"
5
5
@click.prevent =" selected"
6
6
>
@@ -51,7 +51,7 @@ export default {
51
51
</script >
52
52
53
53
<style lang="stylus">
54
- .choice
54
+ .messagist__choices-list-item
55
55
margin-right 40px
56
56
display block
57
57
text-align right
Original file line number Diff line number Diff line change 1
1
<template lang="html">
2
- <li :class =" message.author " >
2
+ <li :class =" cssClass " >
3
3
<span v-html =" message.text" />
4
4
</li>
5
5
</template >
@@ -11,6 +11,12 @@ export default {
11
11
12
12
props: {
13
13
message: Object
14
+ },
15
+
16
+ computed: {
17
+ cssClass () {
18
+ return ` messagist__list-item-${ this .message .author } `
19
+ }
14
20
}
15
21
}
16
22
</script >
@@ -25,7 +31,7 @@ transparent-body()
25
31
position absolute
26
32
border 8px solid transparent
27
33
28
- .message-list -item
34
+ .messagist__list -item
29
35
list-style none
30
36
margin-bottom 5px
31
37
@@ -37,7 +43,7 @@ transparent-body()
37
43
border-radius .5rem
38
44
max-width 80%
39
45
40
- & . system
46
+ & - system
41
47
text-align left
42
48
43
49
span ::before
@@ -46,11 +52,7 @@ transparent-body()
46
52
left - 16px
47
53
bottom 8px
48
54
49
- + .user
50
- margin-top 10px
51
-
52
-
53
- & .user
55
+ & -user
54
56
text-align right
55
57
56
58
span
@@ -62,7 +64,8 @@ transparent-body()
62
64
right - 16px
63
65
bottom 8px
64
66
65
- + .system
66
- margin-top 10px
67
+ & -system + & -user ,
68
+ & -user + & -system
69
+ margin-top 10px
67
70
</style >
68
71
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div class =" Messagist" >
3
- <transition-group name =" message-list " tag =" ul" >
3
+ <transition-group name =" messagist__list " tag =" ul" >
4
4
<message
5
5
v-for =" message in messagesToPrint"
6
6
:key =" message.id"
7
7
:message =" message"
8
- class =" message-list -item"
8
+ class =" messagist__list -item"
9
9
/>
10
10
</transition-group >
11
11
12
12
<div
13
13
v-show =" choicesVisible"
14
- class =" choice-list "
14
+ class =" messagist__choices "
15
15
>
16
16
<choice
17
17
v-for =" (value, key) in current.choices"
18
18
:key =" key"
19
19
:primaryKey =" key"
20
20
:choice =" value"
21
21
@selected =" selected"
22
- class =" choice -list-item"
22
+ class =" messagist__choices -list-item"
23
23
/>
24
24
</div >
25
25
</div >
@@ -164,22 +164,22 @@ export default {
164
164
ul
165
165
padding 20px 50px
166
166
167
- .message-list -item
167
+ .messagist__list -item
168
168
transition all 500ms
169
169
170
- .message-list -item-loading
170
+ .messagist__list -item-loading
171
171
text-align left
172
172
margin-left 40 p
173
173
174
- .message-list -enter
174
+ .messagist__list -enter
175
175
opacity 0
176
176
transform translateY (30px )
177
177
178
- .choice-list -item
178
+ .messagist__choices -item
179
179
transition all 1s
180
180
181
- .choice -list-enter ,
182
- .choice -list-leave-to
181
+ .messagist__choice -list-enter ,
182
+ .messagist__choice -list-leave-to
183
183
opacity 0
184
184
transform translateY (30px )
185
185
</style >
Original file line number Diff line number Diff line change 1
1
import MessagistWrapper from './MessagistWrapper.vue'
2
2
3
- export default {
4
- install ( Vue , options ) {
5
- Vue . component ( 'messagist' , MessagistWrapper )
6
- }
7
- }
3
+ export default MessagistWrapper
You can’t perform that action at this time.
0 commit comments