Merge pull request '加入pinia并测试以便加入购物车功能的实现' (#35) from Brunch_DBK into main
commit
33d0cdd2a9
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,17 @@
|
||||
import {
|
||||
createSSRApp
|
||||
} from "vue";
|
||||
import * as Pinia from 'pinia';
|
||||
// 引入 uView UI
|
||||
import uView from './uni_modules/vk-uview-ui';
|
||||
import App from "./App.vue";
|
||||
export function createApp() {
|
||||
const app = createSSRApp(App);
|
||||
app.use(Pinia.createPinia());
|
||||
// 使用 uView UI
|
||||
app.use(uView);
|
||||
return {
|
||||
app,
|
||||
Pinia,
|
||||
};
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
// 引入
|
||||
import { defineStore } from 'pinia';
|
||||
//定义store
|
||||
export const carStore = defineStore('carStore', {
|
||||
state: () => {
|
||||
return { count: 0 };
|
||||
},
|
||||
// 也可以这样定义
|
||||
// state: () => ({ count: 0 })
|
||||
actions: {
|
||||
increment() {
|
||||
this.count++;
|
||||
},
|
||||
},
|
||||
});
|
Loading…
Reference in new issue