mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-10-22 20:55:25 +00:00
init
This commit is contained in:
1
cc-inspector/src/i18n/en.ts
Normal file
1
cc-inspector/src/i18n/en.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const title = 'my first plugin'
|
1
cc-inspector/src/i18n/zh.ts
Normal file
1
cc-inspector/src/i18n/zh.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const title = '我的第一个插件'
|
19
cc-inspector/src/main.ts
Normal file
19
cc-inspector/src/main.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import pluginConfig from '../cc-plugin.config';
|
||||
import CCP from 'cc-plugin/src/ccp/entry-main';
|
||||
import { BuilderOptions } from 'cc-plugin/src/declare'
|
||||
|
||||
CCP.init(pluginConfig, {
|
||||
load: () => {
|
||||
console.log('plugin load')
|
||||
},
|
||||
builder: {
|
||||
onAfterBuild(target: BuilderOptions) {
|
||||
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
showPanel() {
|
||||
CCP.Adaptation.Panel.open('self.main')
|
||||
}
|
||||
}
|
||||
})
|
15
cc-inspector/src/panel/index.ts
Normal file
15
cc-inspector/src/panel/index.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './index.vue'
|
||||
import CCP from 'cc-plugin/src/ccp/entry-render';
|
||||
import pluginConfig from '../../cc-plugin.config'
|
||||
import ccui from '@xuyanfeng/cc-ui';
|
||||
import '@xuyanfeng/cc-ui/dist/ccui.css';
|
||||
import '@xuyanfeng/cc-ui/iconfont/iconfont.css';
|
||||
|
||||
export default CCP.init(pluginConfig, {
|
||||
ready: function (rootElement: any, args: any) {
|
||||
const app = createApp(App)
|
||||
app.use(ccui)
|
||||
app.mount(rootElement)
|
||||
}
|
||||
})
|
38
cc-inspector/src/panel/index.vue
Normal file
38
cc-inspector/src/panel/index.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<template>
|
||||
<div class="panel">
|
||||
Hi, {{ msg }}
|
||||
<CCButton @click="onClickBtn">btn click-{{ count }}</CCButton>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, ref, provide, nextTick } from 'vue';
|
||||
import PluginConfig from '../../cc-plugin.config';
|
||||
import ccui from '@xuyanfeng/cc-ui';
|
||||
const { CCInput, CCButton } = ccui.components;
|
||||
export default defineComponent({
|
||||
name: 'index',
|
||||
components: { CCButton },
|
||||
setup(props, { emit }) {
|
||||
onMounted(() => {
|
||||
console.log('hi ~~~');
|
||||
});
|
||||
const msg = ref(PluginConfig.manifest.name);
|
||||
const count = ref(0);
|
||||
return {
|
||||
msg,
|
||||
count,
|
||||
onClickBtn() {
|
||||
count.value++;
|
||||
console.log('click btn');
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user