前端学习笔记202309学习笔记第一百零四天-pinia使用指南11

<script setup lang="ts">
import { ref } from 'vue'
import { useCounterStore,useMsgStore } from '../store/index';
defineProps<{ msg: string }>()
const counter=useCounterStore()
const useMsg=useMsgStore()
const count = ref(0)
</script>

<template>
  <h1>{{ msg }}</h1>

  <div class="card">
    <h2>{{ useMsg.msg }}</h2>
    <button type="button" @click="counter.increment">count is {{ counter.count }}</button>
    
  </div>

</template>

<style scoped>
</style>

运行结果

 

posted @ 2023-10-09 09:08  前端导师歌谣  阅读(10)  评论(0)    收藏  举报  来源