Props
Props
Inject
export default { ... provide() { const machineState = {}; Object.defineProperty(machineState, "condition", { enumerable: true, get: () => this.machineState } ); return { machineState }; }
}
export default { ...
inject: ["machineState"]
}
export const useMainStore = createStore({
id: "main",
state: () => ({
machines: [...]
}),
actions: {
getMachines() {
...
}
}
})
export default {
...
setup() {
const main = useMainStore()
return {
machines: main.state.machines,
getMachines: main.getMachines
}
}
}
useMainStore.js
./components/component.vue