📜  v-switch vuex 商店 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:04.493000             🧑  作者: Mango

代码示例1
import { mapState } from "vuex";

computed: {
    ...mapState(["settings"]),
    computedProperty: {
      get() {
        return this.settings.valueInState;
      },
      set(valuePassedThrough) { //the value is passed through the v-model automatically
        this.$store.dispatch(`storeAction`, valuePassedThrough);
      }
    }
}