feat(plugin): add vue example (#3592)

This commit is contained in:
Alex Yang
2023-08-05 23:59:14 -04:00
committed by GitHub
parent 48350d7654
commit 7bf77b566d
21 changed files with 650 additions and 174 deletions
+13
View File
@@ -0,0 +1,13 @@
<script setup lang="ts">
import { ref } from 'vue';
const count = ref(0);
</script>
<template>
<el-button @click="count++">
{{ count }}
</el-button>
</template>
<style scoped></style>
+5
View File
@@ -0,0 +1,5 @@
declare module '*.vue' {
import type { ComponentOptions } from 'vue';
const component: ComponentOptions;
export default component;
}
+18
View File
@@ -0,0 +1,18 @@
import type { PluginContext } from '@affine/sdk/entry';
import ElementPlus from 'element-plus';
import { createApp } from 'vue';
import App from './app.vue';
export const entry = (context: PluginContext) => {
context.register('headerItem', div => {
const app = createApp(App);
app.use(ElementPlus);
app.mount(div, false, false);
return () => {
app.unmount();
};
});
return () => {};
};