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.
 
 
 
 
 

39 lines
769 B

<template>
<view>
<view class="reciver">
{{msg===''?'等待发送':'收到消息:'}}{{msg}}
</view>
</view>
</template>
<script>
import bus from './bus.js'
export default {
data() {
return {
msg: ''
}
},
created() {
uni.$on('cc', this.recive)
bus.$on('cc', this.recive)
},
beforeDestroy() {
uni.$off('cc',this.recive)
bus.$off('cc', this.recive)
},
methods: {
recive(e) {
this.msg = e.msg
}
}
}
</script>
<style>
.reciver {
padding: 40px 0px;
text-align: center;
line-height: 40px;
}
</style>