This commit is contained in:
xuyanfeng 2021-04-01 19:01:29 +08:00
parent 38c74e44d6
commit 2fcb4ff2d1
7 changed files with 763 additions and 1056 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@
"dev-popup": "cross-env NODE_ENV=development webpack-dev-server --open http://localhost:8083/popup.html --inline --progress --hot --port 8083",
"dev-inspector": "cross-env NODE_ENV=development webpack-dev-server --open http://localhost:8084/devInspector.html --inline --progress --hot --port 8084",
"build": "webpack --config ./src/webpack.config.js --progress",
"build-watch": "webpack --config ./src/webpack.config.js --hide-modules --progress --watch"
"build-watch": "webpack --config ./src/webpack.config.js --progress --watch"
},
"dependencies": {
"@types/chrome": "0.0.133",
@ -51,7 +51,7 @@
"vue-loader": "^15.9.6",
"vue-template-compiler": "^2.4.4",
"webpack": "^4.46.0",
"webpack-cli": "^4.6.0",
"webpack-dev-server": "^2.9.1"
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.8.2"
}
}

View File

@ -0,0 +1,117 @@
<template>
<div id="popup">
<div style="display: flex;flex-direction: row;align-items: center;">
<h3 v-show="false"> 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>
<el-button size="mini" @click="onSendMsg">Msg</el-button>
</div>
<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">
<img style="width: 100%;height: auto;" src="./res/money.jpg">
</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">
<img v-show="false" src="./res/github.png" style="height: 100%;">
</a>
</div>
<div style="height: 100%;float: right;margin-right: 10px;">
<a href="https://jq.qq.com/?_wv=1027&k=5SdPdy2" target="_blank">
<img v-show="false" src="./res/qq.png" style="height: 100%;">
</a>
</div>
<div style="height: 100%;float: right;margin-right: 10px;">
<a href="http://forum.cocos.com/t/chrome-creator/55669" target="_blank">
<img v-show="false" src="./res/tiezi.png" style="height: 100%;">
</a>
</div>
</div>
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import 'vue-awesome/icons/flag'
import 'vue-awesome/icons'
import Icon from 'vue-awesome/components/Icon'
import {Component} from 'vue-property-decorator'
import chrome from 'chrome'
import {Button} from 'element-ui'
@Component({
components: {
Icon,
Button,
}
})
export default class Index extends Vue {
longConn: chrome.runtime.Port = false
data() {
return {
title: "cc-inspector",
isShowMoneyPng: true,
}
}
created() {
this._initLongConn();
}
onBtnClickGitHub() {
console.log("onBtnClickGitHub");
}
onClickOptions() {
chrome.tabs.create({url: 'pages/options.html'})
}
_initLongConn() {
if (!this.longConn) {
console.log("[popup] 初始化长连接");
this.longConn = chrome.runtime.connect({name: "popup"});
this.longConn.onMessage.addListener(function (data, sender) {
this._onLongConnMsg(data, sender);
}.bind(this))
}
}
_onLongConnMsg(data, sender) {
// console.log(this.title);
}
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"});
//@import "../index.less";
//#popup{
// width: auto;
//}
}
}
}
</script>
<style scoped lang="less">
</style>

View File

@ -0,0 +1,9 @@
import Vue from 'vue';
import app from './index.vue';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
new Vue({
render: h => h(app)
}).$mount('#app');

View File

@ -1,11 +0,0 @@
import Vue from 'vue';
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI);
import index from './index.vue';
new Vue({
el: '#app',
render: h => h(index)
});

View File

@ -1,117 +1,16 @@
<template>
<div id="popup">
<div style="display: flex;flex-direction: row;align-items: center;">
<h3 v-show="false"> 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>
<el-button size="mini" @click="onSendMsg">Msg</el-button>
</div>
<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">
<img style="width: 100%;height: auto;" src="./res/money.jpg">
</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">
<img v-show="false" src="./res/github.png" style="height: 100%;">
</a>
</div>
<div style="height: 100%;float: right;margin-right: 10px;">
<a href="https://jq.qq.com/?_wv=1027&k=5SdPdy2" target="_blank">
<img v-show="false" src="./res/qq.png" style="height: 100%;">
</a>
</div>
<div style="height: 100%;float: right;margin-right: 10px;">
<a href="http://forum.cocos.com/t/chrome-creator/55669" target="_blank">
<img v-show="false" src="./res/tiezi.png" style="height: 100%;">
</a>
</div>
</div>
<div id='app' style="background: red;">
1111
<!-- <app></app>-->
</div>
</template>
<script>
// import app from './app.vue';
<script lang="ts">
import Vue from 'vue'
import 'vue-awesome/icons/flag'
import 'vue-awesome/icons'
import Icon from 'vue-awesome/components/Icon'
import {Component} from 'vue-property-decorator'
import chrome from 'chrome'
import {Button} from 'element-ui'
@Component({
export default {
name: 'app',
components: {
Icon,
Button,
}
})
export default class Index extends Vue {
longConn: chrome.runtime.Port = false
// data() {
// return {
// title: "cc-inspector",
// isShowMoneyPng: true,
// }
// }
//
// created() {
// this._initLongConn();
// }
//
// onBtnClickGitHub() {
// console.log("onBtnClickGitHub");
// }
//
// onClickOptions() {
// chrome.tabs.create({url: 'pages/options.html'})
// }
//
// _initLongConn() {
// if (!this.longConn) {
// console.log("[popup] ");
// this.longConn = chrome.runtime.connect({name: "popup"});
// this.longConn.onMessage.addListener(function (data, sender) {
// this._onLongConnMsg(data, sender);
// }.bind(this))
// }
// }
//
// _onLongConnMsg(data, sender) {
// // console.log(this.title);
// }
//
// 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"});
// //@import "../index.less";
// //#popup{
// // width: auto;
// //}
// }
// }
// app,
}
};
</script>
<style scoped lang="less">
</style>

View File

@ -30,8 +30,8 @@ let htmlPage = function (title, filename, chunks, template) {
module.exports = {
mode: 'development',
entry: {
test: resolve('test'),
popup: resolve('popup'),
// test: resolve('test'),
popup: resolve('popup/index.js'),
devtools: resolve('devtools'),
devtools_panel: resolve('devtools/panel'),
background: resolve('background'),
@ -62,7 +62,7 @@ module.exports = {
dry: false,//启用删除文件
}),
htmlPage('test', 'test', ['test']),
// htmlPage('test', 'test', ['test']),
htmlPage('popup', 'popup', ['popup']),
htmlPage('devtools', 'devtools', ['devtools']),
htmlPage('devtools_panel', 'devtools_panel', ['devtools_panel']),
@ -185,7 +185,7 @@ module.exports = {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['*', '.js', '.vue', '.json', '.ts', '.tsx']
extensions: ['*', '.ts', '.js', '.vue', '.json']
},
devServer: {
contentBase: './dist',//本地服务器所加载的页面所在的目录