You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
1.5 KiB
88 lines
1.5 KiB
|
3 years ago
|
<template>
|
||
|
2 years ago
|
<div v-show="show" @click="close()">
|
||
|
3 years ago
|
<div class="emotion-box" :style="{'left':x+'px','top':y+'px'}">
|
||
|
2 years ago
|
<el-scrollbar style="height:250px">
|
||
|
3 years ago
|
<div class="emotion-item-list">
|
||
|
2 years ago
|
<div class="emotion-item" v-for="(emoText, i) in $emo.emoTextList" :key="i"
|
||
|
2 years ago
|
@click="onClickEmo(emoText)" v-html="$emo.textToImg(emoText)">
|
||
|
3 years ago
|
</div>
|
||
|
3 years ago
|
</div>
|
||
|
3 years ago
|
</el-scrollbar>
|
||
|
|
</div>
|
||
|
3 years ago
|
</div>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<script>
|
||
|
|
export default {
|
||
|
|
name: "emotion",
|
||
|
|
data() {
|
||
|
2 years ago
|
return {
|
||
|
|
show: false,
|
||
|
|
pos: {
|
||
|
|
x: 0,
|
||
|
|
y: 0
|
||
|
|
}
|
||
|
|
}
|
||
|
3 years ago
|
},
|
||
|
|
methods: {
|
||
|
2 years ago
|
onClickEmo(emoText) {
|
||
|
3 years ago
|
let emotion = `#${emoText};`
|
||
|
|
this.$emit('emotion', emotion)
|
||
|
2 years ago
|
},
|
||
|
|
open(pos) {
|
||
|
|
this.pos = pos;
|
||
|
|
this.show = true;
|
||
|
|
},
|
||
|
|
close() {
|
||
|
|
this.show = false;
|
||
|
3 years ago
|
}
|
||
|
|
},
|
||
|
|
computed: {
|
||
|
|
x() {
|
||
|
|
return this.pos.x - 200;
|
||
|
|
},
|
||
|
|
y() {
|
||
|
2 years ago
|
return this.pos.y - 280;
|
||
|
3 years ago
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
<style scoped lang="scss">
|
||
|
3 years ago
|
|
||
|
2 years ago
|
|
||
|
3 years ago
|
.emotion-box {
|
||
|
|
position: fixed;
|
||
|
2 years ago
|
width: 500px;
|
||
|
3 years ago
|
box-sizing: border-box;
|
||
|
|
padding: 5px;
|
||
|
2 years ago
|
border: 1px solid #53a0e79c;
|
||
|
3 years ago
|
border-radius: 5px;
|
||
|
|
background-color: #f5f5f5;
|
||
|
2 years ago
|
box-shadow: 0px 0px 10px #ccc;
|
||
|
|
|
||
|
3 years ago
|
.emotion-item-list {
|
||
|
|
display: flex;
|
||
|
|
flex-wrap: wrap;
|
||
|
|
|
||
|
|
.emotion-item {
|
||
|
|
text-align: center;
|
||
|
|
cursor: pointer;
|
||
|
2 years ago
|
padding: 5px;
|
||
|
2 years ago
|
|
||
|
3 years ago
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
&:after {
|
||
|
2 years ago
|
content: "";
|
||
|
|
position: absolute;
|
||
|
|
left: 185px;
|
||
|
|
bottom: -30px;
|
||
|
|
width: 0;
|
||
|
|
height: 0;
|
||
|
|
border-style: solid dashed dashed;
|
||
|
|
border-color: #f5f5f5 transparent transparent;
|
||
|
|
overflow: hidden;
|
||
|
|
border-width: 15px;
|
||
|
3 years ago
|
}
|
||
|
|
}
|
||
|
2 years ago
|
</style>
|