添加页面组件、添加页面组件接口、添加pinia
This commit is contained in:
@ -1,29 +1,18 @@
|
||||
<!-- DynamicSlotsComponent.vue -->
|
||||
<template>
|
||||
<div>
|
||||
<!-- 动态插槽 -->
|
||||
|
||||
<div>
|
||||
<slot name="header"></slot>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<slot name="main"></slot>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<slot name="footer"></slot>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps } from 'vue';
|
||||
import { useCounterStore } from '@/stores/useSchemeStore'
|
||||
// 可以在组件中的任意位置访问 `store` 变量 ✨
|
||||
const store = useCounterStore()
|
||||
function add() {
|
||||
store.increment()
|
||||
}
|
||||
function sub() {
|
||||
store.decrement()
|
||||
}
|
||||
</script>
|
||||
|
||||
// 接收一个动态插槽名作为 prop
|
||||
const props = defineProps({
|
||||
dynamicSlotName: String
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div>{{ store.count }}</div>
|
||||
<a-button @click=add>add</a-button>
|
||||
<a-button @click=sub>sub</a-button>
|
||||
|
||||
</template>
|
||||
Reference in New Issue
Block a user