
vue3
文章平均质量分 50
夏2同学
这里是属于代码的世界,没有花俏艳丽的魔法,有的,仅仅是繁衍到巅峰的代码!
展开
-
Vue超简单的全局状态管理 - Pinia的最佳实践
1. 安装yarn add pinia# or with npmnpm install pinia// vue3中import { createPinia } from 'pinia'app.use(createPinia())2.store2.1 创建文件import { defineStore } from 'pinia'export const useCounterStore = defineStore({ id: 'count', state: () =>原创 2022-05-30 13:24:10 · 1126 阅读 · 1 评论 -
Vue3入门笔记—2022年1月9日
1. 响应式值(ref和reactive)一般:1、ref用于单个值,2、reactive用于对象类型的数据。例如:const name = ref("zhangsan")const user = reactive({ 'name': 'zhangsan', 'age': 18})// 当用ref去封装对象类型的数据时,数据发生变化,watch函数监听不到,// 而reactive函数可以监控的到watch(user,(newVal)=>{ // 输出新的原创 2022-01-09 20:54:19 · 612 阅读 · 0 评论