45 lines
1.2 KiB
Vue
45 lines
1.2 KiB
Vue
<template>
|
|
<div class="layout-default flex h-screen w-full">
|
|
<div class="app-aside">
|
|
<layout-sidebar />
|
|
</div>
|
|
|
|
<div class="flex-1 flex flex-col min-w-0">
|
|
<div class="app-header">
|
|
<layout-header />
|
|
</div>
|
|
<div class="app-main flex-1 min-h-0">
|
|
<layout-main />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import LayoutMain from './components/main.vue'
|
|
import LayoutSidebar from './components/sidebar/index.vue'
|
|
import LayoutHeader from './components/header/index.vue'
|
|
import { Push } from "@/common/push.js";
|
|
|
|
const connection = new Push({
|
|
url: import.meta.env.VITE_PUSH_URL, // websocket地址
|
|
app_key: '2ce3ce22329517213caa7dad261f5695',
|
|
});
|
|
|
|
// 浏览器监听user-1
|
|
const user_channel = connection.subscribe(`platform_1`);
|
|
// const user_channel = connection.subscribe(`store_merchant_${1}`);
|
|
|
|
// 当user-2频道有message事件的消息时
|
|
user_channel.on('message', function (data) {
|
|
console.log("收到消息--",data);
|
|
if(data.event=='platform_print'){
|
|
console.log('收到打印消息');
|
|
}
|
|
});
|
|
// 断线事件
|
|
user_channel.on('close', function () {
|
|
|
|
});
|
|
</script>
|