You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
285 B
21 lines
285 B
|
6 days ago
|
import { defineStore } from "pinia";
|
||
|
|
import { ref } from "vue";
|
||
|
|
|
||
|
|
// 方式一,创建缓存方式
|
||
|
|
export const useTest = defineStore("test", () => {
|
||
|
|
const data = ref();
|
||
|
|
|
||
|
|
return {
|
||
|
|
data,
|
||
|
|
};
|
||
|
|
});
|
||
|
|
|
||
|
|
// 方式2
|
||
|
|
export function useTest2() {
|
||
|
|
const data = ref();
|
||
|
|
|
||
|
|
return {
|
||
|
|
data,
|
||
|
|
};
|
||
|
|
}
|