@click="delete messages.get(mapKey)"
не работает...@click="messages.delete(mapKey)"
ругается... Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):
(Emitted value instead of an instance of Error)
<template>
<div class="messenger">
<transition-group name="msgAnimation" tag="div">
<div v-for="(obj, i) in messages" :key="obj.key" class="wrapper">
<div class="wrapper__block" @click="messages.splice(i, 1)">
{{ obj.msg }}
</div>
</div>
</transition-group>
</div>
</template>
<style lang="scss" scoped>
$height-block: 9vmin;
$height-margin: 1vmin;
$transition: 0.5s;
$scroll-width: 0.5vmin;
.messenger {
display: flex;
flex-direction: column;
justify-content: flex-end;
.wrapper {
* {
box-sizing: border-box;
}
width: 100%;
height: $height-block + $height-margin;
display: flex;
align-items: flex-start;
justify-content: flex-start;
overflow: hidden;
&__block {
background: rgba(42, 29, 29, 0.8);
height: $height-block;
width: 100%;
overflow: hidden;
margin-top: $height-margin;
font-size: 2vmin;
padding: $height-margin;
color: white;
display: flex;
align-items: center;
justify-content: center;
overflow-x: hidden;
overflow-y: auto;
//word-wrap: break-word;
word-break: break-all;
flex-wrap: wrap;
&::-webkit-scrollbar {
width: $scroll-width;
height: 100%;
}
&::-webkit-scrollbar-thumb {
background: #e93535;
border-radius: $scroll-width / 2;
}
}
}
.msgAnimation-enter,
.msgAnimation-leave-to {
animation: anim $transition * 2 linear;
@keyframes anim {
0% {
}
50% {
opacity: 0;
height: $height-block + $height-margin;
}
100% {
opacity: 0;
height: 0;
}
}
}
}
</style>
<script>
export default {
name: "Messenger",
data() {
return {
totalAmount: 0,
messages: [{ key: 0, msg: "Are u hacker" }],
};
},
created() {
window.authorizationMessage =
function (msg) {
this.totalAmount++;
this.messages.push({ key: this.totalAmount, msg: msg });
}.bind(this)
};
</script>
Но если опишу
Всё работает