qlin 8332b1114c
feat: 添加 login 插件 (#168)
* feat: 添加 login 插件

* docs: 优化 access docs 文档

* refactor: beforeRender迁移到router创建后

* fix: 修复清除webpack-cache问题

* refactor: 优化 plugin 插件

Co-authored-by: wanchun <445436867@qq.com>
2023-01-11 15:51:43 +08:00

22 lines
593 B
JavaScript

import { defineStore } from 'pinia';
// useStore could be anything like useUser, useCart
// the first argument is a unique id of the store across your application
export const useStore = defineStore('main', {
// other options...
state: () => ({
// all these properties will have their type inferred automatically
counter: 0,
name: 'Eduardo',
isAdmin: true,
}),
actions: {
increment() {
this.counter++;
},
randomizeCounter() {
this.counter = Math.round(100 * Math.random());
},
},
});