首页 > 解决方案 > 使用 Vue.js 组合 API 的全局反应状态

问题描述

使用像 vuex 这样的 vue-composition API 的最佳解决方案是什么?

import { reactive, readonly } from "vue";

const state = reactive({
  count: 0
});

const increment = function () {
  state.count++;
}

export default { state: readonly(state), increment };

标签: vue.jsvuexvue-composition-api

解决方案


推荐阅读