基于template做代码结构调整

This commit is contained in:
许彦峰
2019-03-15 19:10:02 +08:00
parent 4e808384fe
commit 9579ed24d2
42 changed files with 68714 additions and 2085 deletions

View File

@@ -1,3 +1,12 @@
chrome.devtools.panels.create('panel', 'img/logo.png', 'pages/panel.html', function (panel) {
console.log('hello from callback')
chrome.devtools.panels.create('cc-inspector', 'img/logo.png', 'pages/panel.html', function (panel) {
panel.onShown.addListener(function (window) {
console.log("panel show");
});
panel.onHidden.addListener(function (window) {
console.log("panel hide");
});
panel.onSearch.addListener(function (action, query) {
console.log("panel search!");
return false;
});
})

View File

@@ -1,12 +1,15 @@
<template lang="html">
<div>
<span>{{tips}}</span>
<el-button size="mini" @click="onClickTest"> 检测</el-button>
</div>
</template>
<script>
export default {
data: () => ({}),
data: () => ({
tips: "",
}),
computed: {},
created() {
},
@@ -14,7 +17,16 @@
},
methods: {
onClickTest() {
this.tips = "";
console.log("onClickTest")
let views = chrome.extension.getViews({type: 'popup'});
if (views.length > 0) {
this.tips = "找到popup";
console.log(views[0].location.href);
} else {
this.tips = "未找到popup";
}
}
}
}