[add] EventBus使用
This commit is contained in:
11
src/App.vue
11
src/App.vue
@@ -1,11 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { ElDialog } from 'element-plus';
|
||||
import { ref } from 'vue';
|
||||
import 'vue-loading-overlay/dist/vue-loading.css';
|
||||
import GameCanvas from './components/GameCanvas.vue';
|
||||
import Popup from './components/Popup.vue';
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
window["eventBus"].on('alert', (msg: string) => {
|
||||
visible.value = true;
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<GameCanvas />
|
||||
<el-dialog v-model="visible" :show-close="false">
|
||||
<Popup />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
|
||||
11
src/components/Popup.vue
Normal file
11
src/components/Popup.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import 'vue-loading-overlay/dist/vue-loading.css';
|
||||
|
||||
const input = ref('')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-input v-model="input" placeholder="Please input A" />
|
||||
<el-input v-model="input" placeholder="Please input B" />
|
||||
</template>
|
||||
Reference in New Issue
Block a user