2019-03-15 10:08:39 +08:00
|
|
|
<template>
|
2019-03-16 11:27:49 +08:00
|
|
|
<div style="width: auto;">
|
|
|
|
<div style="display: flex;flex-direction: row;align-items: center;">
|
|
|
|
<h3>{{title}}</h3>
|
|
|
|
<div style="flex: 1"></div>
|
|
|
|
<el-button size="mini" @click="onClickOptions">设置</el-button>
|
|
|
|
<el-button size="mini" @click="onMsgToBg">To-Bg</el-button>
|
2019-03-16 18:44:32 +08:00
|
|
|
<el-button size="mini" @click="onSendMsg">Msg</el-button>
|
2019-03-16 11:27:49 +08:00
|
|
|
</div>
|
2019-03-15 10:08:39 +08:00
|
|
|
<div style="text-align: center;width: 100%; color: #6d6d6d;">
|
|
|
|
<span>支持作者</span>
|
|
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<div style="margin:0 auto;width:100%;">
|
|
|
|
<div style="width: 200px; margin: 0 auto;" v-show="isShowMoneyPng">
|
2019-03-16 12:31:00 +08:00
|
|
|
<img style="width: 100%;height: auto;" src="./res/money.jpg">
|
2019-03-15 10:08:39 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<div id="foot" style="height: 30px;">
|
|
|
|
<span style="font-size: 14px;float: left;text-align: center;line-height: 30px;color: #6d6d6d;">联系方式:</span>
|
|
|
|
<div style="height: 100%;float: right;margin-right: 10px;">
|
|
|
|
<a href="https://github.com/tidys/CocosCreatorPlugins/tree/master/CocosCreatorInspector" target="_blank">
|
2019-03-16 12:31:00 +08:00
|
|
|
<img src="./res/github.png" style="height: 100%;">
|
2019-03-15 10:08:39 +08:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div style="height: 100%;float: right;margin-right: 10px;">
|
|
|
|
<a href="https://jq.qq.com/?_wv=1027&k=5SdPdy2" target="_blank">
|
2019-03-16 12:31:00 +08:00
|
|
|
<img src="./res/qq.png" style="height: 100%;">
|
2019-03-15 10:08:39 +08:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div style="height: 100%;float: right;margin-right: 10px;">
|
|
|
|
<a href="http://forum.cocos.com/t/chrome-creator/55669" target="_blank">
|
2019-03-16 12:31:00 +08:00
|
|
|
<img src="./res/tiezi.png" style="height: 100%;">
|
2019-03-15 10:08:39 +08:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Vue from 'vue'
|
|
|
|
import 'vue-awesome/icons/flag'
|
|
|
|
import 'vue-awesome/icons'
|
|
|
|
import Icon from 'vue-awesome/components/Icon'
|
|
|
|
|
|
|
|
Vue.component('icon', Icon);
|
|
|
|
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
title: "cc-inspector",
|
|
|
|
isShowMoneyPng: true,
|
|
|
|
}
|
|
|
|
},
|
2019-03-16 18:44:32 +08:00
|
|
|
created() {
|
|
|
|
this._initLongConn();
|
|
|
|
},
|
2019-03-15 10:08:39 +08:00
|
|
|
methods: {
|
|
|
|
onBtnClickGitHub() {
|
|
|
|
console.log("onBtnClickGitHub");
|
2019-03-16 12:31:00 +08:00
|
|
|
},
|
|
|
|
onClickOptions() {
|
|
|
|
chrome.tabs.create({url: 'pages/options.html'})
|
|
|
|
},
|
2019-03-16 18:44:32 +08:00
|
|
|
_initLongConn() {
|
|
|
|
if (!this.longConn) {
|
|
|
|
console.log("[popup] 初始化长连接");
|
|
|
|
this.longConn = chrome.runtime.connect({name: "popup"});
|
2019-03-16 19:18:29 +08:00
|
|
|
this.longConn.onMessage.addListener(function (data, sender) {
|
|
|
|
this._onLongConnMsg(data, sender);
|
|
|
|
}.bind(this))
|
2019-03-16 18:44:32 +08:00
|
|
|
}
|
|
|
|
},
|
2019-03-16 19:18:29 +08:00
|
|
|
_onLongConnMsg(data, sender) {
|
|
|
|
console.log(this.title);
|
|
|
|
},
|
2019-03-16 18:44:32 +08:00
|
|
|
onMsgToBg() {
|
|
|
|
// 因为webpack的原因,这种方式可能拿不到里面的function, var
|
|
|
|
// chrome.extension.getBackgroundPage();
|
|
|
|
|
|
|
|
// 发送消息到background.js
|
|
|
|
chrome.runtime.sendMessage('content msg', function (data) {
|
|
|
|
console.log(data);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onSendMsg() {
|
|
|
|
if (this.longConn) {
|
|
|
|
this.longConn.postMessage({send: "hello"});
|
2019-03-16 12:31:00 +08:00
|
|
|
}
|
2019-03-16 18:44:32 +08:00
|
|
|
},
|
2019-03-15 10:08:39 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|