mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-19 08:28:41 +00:00
aaa
This commit is contained in:
parent
38c74e44d6
commit
2fcb4ff2d1
1543
CocosCreatorInspector/package-lock.json
generated
1543
CocosCreatorInspector/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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"
|
||||
}
|
||||
}
|
||||
|
117
CocosCreatorInspector/src/popup/app.vue
Normal file
117
CocosCreatorInspector/src/popup/app.vue
Normal 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>
|
9
CocosCreatorInspector/src/popup/index.js
Normal file
9
CocosCreatorInspector/src/popup/index.js
Normal 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');
|
@ -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)
|
||||
});
|
@ -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>
|
||||
|
@ -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',//本地服务器所加载的页面所在的目录
|
||||
|
Loading…
x
Reference in New Issue
Block a user