创建
约 56 字小于 1 分钟
2025-07-17
store.ts
import { defineStore } from 'pinia'
export const useMainStore = defineStore('main', () => {
const count = ref(0)
return { count }
})
HelloWorld.vue
<template>
<p>Count: {{ mainStroe.count }}</p>
</template>
<script setup lang="ts">
import { useMainStore } from './store.ts'
const mainStroe = useMainStore()
</script>