2024-01-05 16:45:23 +08:00
|
|
|
<template>
|
2024-01-08 19:50:06 +08:00
|
|
|
<div class="popup">
|
2025-01-08 17:51:18 +08:00
|
|
|
<ol>
|
|
|
|
<li class="tips">Scan me on WeChat</li>
|
|
|
|
<li class="tips">Add me as a friend</li>
|
|
|
|
</ol>
|
|
|
|
<img class="png" src="./res/friend.png" alt="" />
|
2024-01-08 19:50:06 +08:00
|
|
|
<div class="foot">
|
|
|
|
<div class="space"></div>
|
|
|
|
<div v-if="version">ver:{{ version }}</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script lang="ts">
|
2024-12-09 16:23:58 +08:00
|
|
|
import ccui from "@xuyanfeng/cc-ui";
|
2024-01-08 19:50:06 +08:00
|
|
|
import CCP from "cc-plugin/src/ccp/entry-render";
|
|
|
|
import { ChromeConst } from "cc-plugin/src/chrome/const";
|
2025-01-08 17:51:18 +08:00
|
|
|
import { defineComponent, onMounted, ref } from "vue";
|
2025-01-10 15:22:32 +08:00
|
|
|
import { Page } from "../../core/types";
|
|
|
|
import { ga } from "../../ga";
|
2024-12-09 16:23:58 +08:00
|
|
|
const { CCInput, CCButton, CCInputNumber, CCSelect, CCCheckBox, CCColor } = ccui.components;
|
2024-01-08 19:50:06 +08:00
|
|
|
export default defineComponent({
|
|
|
|
name: "popup",
|
2024-01-09 16:34:16 +08:00
|
|
|
components: {
|
|
|
|
CCInput,
|
|
|
|
CCButton,
|
|
|
|
CCInputNumber,
|
|
|
|
CCSelect,
|
|
|
|
CCCheckBox,
|
|
|
|
CCColor,
|
|
|
|
},
|
2024-01-08 19:50:06 +08:00
|
|
|
setup(props, ctx) {
|
2025-01-10 15:22:32 +08:00
|
|
|
ga.openView(Page.Popup);
|
2024-01-08 19:50:06 +08:00
|
|
|
const title = ref(CCP.manifest.name);
|
|
|
|
const version = ref(CCP.manifest.version);
|
|
|
|
let longConn: chrome.runtime.Port | null = null;
|
|
|
|
function _initLongConn() {
|
|
|
|
if (!longConn) {
|
|
|
|
console.log("[popup] 初始化长连接");
|
|
|
|
if (chrome && chrome.runtime) {
|
|
|
|
longConn = chrome.runtime.connect({ name: "popup" });
|
|
|
|
longConn.onMessage.addListener((data: any, sender: any) => {
|
|
|
|
_onLongConnMsg(data, sender);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _onLongConnMsg(data: string, sender: any) {
|
|
|
|
// console.log( title);
|
|
|
|
}
|
|
|
|
onMounted(() => {
|
|
|
|
_initLongConn();
|
|
|
|
});
|
|
|
|
return {
|
|
|
|
title,
|
|
|
|
version,
|
|
|
|
onClickOptions() {
|
|
|
|
if (chrome && chrome.tabs) {
|
|
|
|
chrome.tabs.create({ url: ChromeConst.html.popup });
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onBtnClickGitHub() {
|
|
|
|
console.log("onBtnClickGitHub");
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
|
|
.popup {
|
|
|
|
width: 300px;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
padding: 10px;
|
|
|
|
|
2025-01-08 17:51:18 +08:00
|
|
|
.tips {
|
|
|
|
color: #000000;
|
2024-01-08 19:50:06 +08:00
|
|
|
}
|
|
|
|
.foot {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
height: 30px;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
.space {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.icon {
|
|
|
|
margin: 0 3px;
|
|
|
|
width: auto;
|
|
|
|
height: 20px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|