inleft
2022-08-31 3c71cc74e6dd5f1015329c64e11e8ec1cd7a97c1
commit | author | age
afab3a 1 <template>
271ca6 2     <div>
I 3         <div class="OwO fadeIn " style="z-index:10" v-bind:class="{'OwO-open':open}">
4             <div class="OwO-logo" @click="openOwO"><span>OωO</span></div>
5             <div class="OwO-body" style="width: 100%;position: initial;">
6                 <div class="OwO-jio"></div>
7                 <ul class="OwO-items OwO-items-emoticon " style="max-height: 197px;"
8                     v-for="(packageKey, index ) in packages" v-bind:class="{'OwO-items-show':selectTabIndex==index}">
9                     <div v-if="myConfig[packageKey].type=='image'">
afab3a 10
271ca6 11                         <li class="OwO-item" :data-id="item.data" :title="item.text"
I 12                             v-for="(item,index ) in myConfig[packageKey].container" @click="getCotent(item,false)">
13                             <img loading="lazy" :class="'biaoqing '+item.css" :src="item.icon">
14                         </li>
15                     </div>
afab3a 16
271ca6 17                     <div v-else>
I 18                         <li class="OwO-item" data-id="not-given" :title="item.text"
19                             v-for="(item,index) in myConfig[packageKey].container" @click="getCotent(item,true)">
20                             {{item.icon}}
21                         </li>
22                     </div>
afab3a 23                 </ul>
271ca6 24
I 25                 <div class="OwO-bar" style="height: auto;">
26                     <ul class="OwO-packages">
27                         <li v-bind:class="{'OwO-package-active':selectTabIndex==index}" @click="switchTab(index)"
28                             style="border-bottom: 1px solid;" v-for="(packagesName,index) in packages">
29                             <span>{{packagesName}}</span>
30                         </li>
31                     </ul>
32                 </div>
afab3a 33             </div>
I 34         </div>
35     </div>
36 </template>
37
38 <script>
271ca6 39     import '../../assets/css/OwO.min.css';
I 40     import OwOjsonConfig from '../../assets/OwO.json';
afab3a 41
I 42     export default {
43         data() {
44             return {
271ca6 45                 open: false,
afab3a 46                 selectTabIndex: 0,
I 47                 tabNameList: [],
48                 packages: null,
49                 myConfig: OwOjsonConfig,
271ca6 50                 selectContext: null
afab3a 51             }
I 52         },
53         methods: {
54             switchTab(index) {
55                 this.selectTabIndex = index;
56             },
57             openOwO() {
58                 this.open = !this.open
59                 this.init()
60             },
61             init() {
62                 if (this.packages != null) {
63                     return
64                 }
65                 this.packages = Object.keys(OwOjsonConfig);
271ca6 66             },
I 67             getCotent(item, outputType) {
68                 if (outputType) {
69                     this.selectContext = item.icon;
70                 } else {
71                     this.selectContext = item.data;
72                 }
73                 this.$emit("insertOwO", this.selectContext)
74             },
75             
afab3a 76         }
I 77     }
78 </script>
79
271ca6 80 <style lang="less">
I 81
afab3a 82 </style>