Browse Source

pinia

pull/11/head
zhangtao 2 years ago
parent
commit
dbb5c5d2bc
4 changed files with 7 additions and 2 deletions
  1. +1
    -0
      package.json
  2. +1
    -1
      src/components/Search/index.vue
  3. +4
    -1
      src/store/index.js
  4. +1
    -0
      src/store/modules/user.js

+ 1
- 0
package.json View File

"dayjs": "^1.11.2", "dayjs": "^1.11.2",
"mockjs": "^1.1.0", "mockjs": "^1.1.0",
"pinia": "^2.0.13", "pinia": "^2.0.13",
"pinia-persistedstate-plugin": "^0.1.0",
"tinymce": "^5.10.2", "tinymce": "^5.10.2",
"vue": "^3.2.16", "vue": "^3.2.16",
"vue-router": "^4.0.14", "vue-router": "^4.0.14",

+ 1
- 1
src/components/Search/index.vue View File

</template> </template>


<script> <script>
import { computed, reactive, ref, unref, toRaw } from 'vue'
import { computed, ref, unref } from 'vue'
import { NForm } from 'naive-ui' import { NForm } from 'naive-ui'
import AreaCascader from '@/components/AreaCascader/index.vue' import AreaCascader from '@/components/AreaCascader/index.vue'
export default { export default {

+ 4
- 1
src/store/index.js View File

import { createPinia } from 'pinia' import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-persistedstate-plugin'
const store = createPinia()
store.use(createPersistedState())


export function setupStore(app) { export function setupStore(app) {
app.use(createPinia())
app.use(store)
} }

+ 1
- 0
src/store/modules/user.js View File

import { removeToken } from '@/utils/token' import { removeToken } from '@/utils/token'


export const useUserStore = defineStore('user', { export const useUserStore = defineStore('user', {
persist: true,
state() { state() {
return { return {
userInfo: {} userInfo: {}

Loading…
Cancel
Save