
Vuex
宇宙无敌饼干小怪兽
一个工程师成长路上的点点滴滴......
展开
-
Vuex中使用自定义useStore
原创 2021-09-20 18:29:36 · 1973 阅读 · 0 评论 -
登录模块 vuex 异步请求 actions async await
原创 2021-09-20 11:58:11 · 1317 阅读 · 0 评论 -
Module<S,R> 泛型
原创 2021-09-19 23:28:06 · 352 阅读 · 0 评论 -
createStore<S> 指定泛型
原创 2021-09-19 23:17:25 · 148 阅读 · 0 评论 -
mapState的封装 模块
原创 2021-09-17 23:27:22 · 145 阅读 · 0 评论 -
vuex store module 模块化
原创 2021-09-17 16:57:35 · 185 阅读 · 0 评论 -
mapMutations辅助函数
图解原创 2021-09-17 08:38:08 · 102 阅读 · 0 评论 -
Mutation常量类型 vuex
图解store>mutation-types.jsexport const INCREMENT_N = "incrementN";App.vue<template> <div class="app"> <table border="1"> <h2>{{ $store.state.counter }}</h2> <button @click="increment">+1</bu原创 2021-09-16 17:08:50 · 143 阅读 · 0 评论 -
mapState 和mapGetters 封装 hooks 出口文件
图解hooks>useMapper.jsimport { useStore } from "vuex";import { computed } from "vue";export function useMapper(mapper, mapFunc) { const store = useStore(); const gettersFns = mapFunc(mapper); const getters = {}; Object.keys(gettersFns).forEa原创 2021-09-16 16:36:45 · 97 阅读 · 0 评论 -
vuex hooks 封装 useGetters
图示hooks>useGetters.jsimport { mapGetters, useStore } from "vuex";import { computed } from "vue";export function useGetters(mapper) { const store = useStore(); const gettersFns = mapGetters(mapper); const getters = {}; Object.keys(gettersFn原创 2021-09-16 14:57:27 · 300 阅读 · 0 评论 -
vuex 批量拿到getters中的数据
图示Home.vue<template> <div class="home"> <table border="1"> <h2>{{ $store.getters.totalBooksPrice }}</h2> <h2>{{ $store.getters.info }}</h2> <hr /> <h2>{{ totalBooksPrice原创 2021-09-16 14:50:19 · 653 阅读 · 0 评论 -
vuex getters 返回一个函数
逻辑图index.jsimport { createStore } from "vuex";export default createStore({ state() { return { counter: 10, name: "Alice", age: 19, height: 180, books: [ { name: "Alice", price: 10, count: 1 }, { name原创 2021-09-16 14:27:20 · 342 阅读 · 0 评论 -
vuex getters 计算属性 使用getters中的数据
原创 2021-09-16 14:18:57 · 321 阅读 · 0 评论 -
vuex getters 类似计算属性
原创 2021-09-16 14:12:56 · 142 阅读 · 0 评论 -
setup使用mapState hooks封装 批量引入Vuex中的数据
图示hooks>useState.jsimport { useStore, mapState } from "vuex";import { computed } from "vue";export function useState(mapper) { const store = useStore(); const storeStateFns = mapState(mapper); const storeState = {}; Object.keys(storeState原创 2021-09-16 13:08:12 · 209 阅读 · 0 评论 -
setup中如何使用mapState 批量导入Vuex中的数据
视图Home.vue<template> <div class="home"> <table border="1"> <h5>{{ name }}</h5> <h5>{{ age }}</h5> <h5>{{ counter }}</h5> </table> </div></template>&原创 2021-09-16 12:54:36 · 1026 阅读 · 2 评论 -
批量使用vuex中的数据_mapState
原创 2021-09-16 11:28:55 · 151 阅读 · 0 评论