|
|
@@ -5,25 +5,29 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import pubsub from 'pubsub-js';
|
|
|
+// import pubsub from 'pubsub-js';
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- msg:""
|
|
|
- }
|
|
|
+ msg: "",
|
|
|
+ };
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.pid = pubsub.subscribe("part1",(pName,pValue) => {
|
|
|
- console.log(pName,pValue)
|
|
|
- this.msg = pValue;
|
|
|
- })
|
|
|
+ // this.pid = pubsub.subscribe("part1",(pName,pValue) => {
|
|
|
+ // console.log(pName,pValue)
|
|
|
+ // this.msg = pValue;
|
|
|
+ // })
|
|
|
+ this.$bus.$on("part2", (data) => {
|
|
|
+ console.log(data);
|
|
|
+ this.msg = data;
|
|
|
+ });
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
- pubsub.unsubscribe(this.pid);
|
|
|
- }
|
|
|
-}
|
|
|
+ // pubsub.unsubscribe(this.pid);
|
|
|
+ this.$bus.$off("part2");
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-
|
|
|
</style>
|