commit | author | age
|
c14e32
|
1 |
<template> |
I |
2 |
<div id="area"> |
|
3 |
<a-form-item> |
|
4 |
<a-textarea ref="targetArea" :rows="4" v-model="visitorContent" :placeholder="this.$attrs.replyHolder" |
|
5 |
class="OwO-textarea" /> |
|
6 |
</a-form-item> |
|
7 |
<span class="myTip fadeIn" v-if="showTip">现在你可以发送表情啦</span> |
|
8 |
<div ref="container" class="OwO fadeIn" v-show="init || visitorContent.length>0"></div> |
|
9 |
</div> |
|
10 |
</template> |
|
11 |
|
|
12 |
<script> |
|
13 |
import 'owo/dist/OwO.min.css'; |
|
14 |
import OWO from '../../js/myOwO.js' |
|
15 |
import OwOjsonConfig from '../../assets/OwO.json' |
|
16 |
|
|
17 |
export default { |
|
18 |
props: { |
|
19 |
content: String |
|
20 |
}, |
|
21 |
data() { |
|
22 |
return { |
|
23 |
init: false, |
|
24 |
showTip: false, |
|
25 |
visitorContent: '', |
|
26 |
} |
|
27 |
}, |
|
28 |
watch: { |
|
29 |
visitorContent: function(newValue, oldValue) { |
|
30 |
if (newValue.length > 0) { |
|
31 |
this.init = true; |
|
32 |
this.initOwO(); |
|
33 |
if (!this.showTip) { |
|
34 |
this.showTip = true; |
|
35 |
setTimeout(() => { |
|
36 |
this.showTip = false; |
|
37 |
}, 5000); |
|
38 |
} |
|
39 |
} |
|
40 |
this.$emit("update:content", newValue) |
|
41 |
}, |
|
42 |
}, |
|
43 |
methods: { |
054cde
|
44 |
|
c14e32
|
45 |
initOwO() { |
I |
46 |
var OwO_demo = new OwO({ |
|
47 |
logo: 'OωO表情', |
|
48 |
// container: document.getElementsByClassName('OwO')[0], |
|
49 |
// target: document.getElementsByClassName('OwO-textarea')[0], |
|
50 |
container: this.$refs.container, |
|
51 |
target: this.$refs.targetArea.$el, |
|
52 |
// api: './OwO.json', |
|
53 |
// api: 'http://diygod.github.io/OwO/demo/OwO.json', |
|
54 |
jsonText: OwOjsonConfig, |
|
55 |
position: 'down', |
|
56 |
width: '100%', |
|
57 |
maxHeight: '250px' |
|
58 |
}); |
|
59 |
} |
|
60 |
} |
|
61 |
} |
|
62 |
</script> |
|
63 |
|
|
64 |
<style> |
|
65 |
|
|
66 |
</style> |