From be75d41cf54d50177a7db7e9218e8d1c820ae830 Mon Sep 17 00:00:00 2001 From: Austin Story Date: Tue, 2 Oct 2018 03:53:49 -0500 Subject: [PATCH] feat: add ability to turn off devtools on vuex by passing an off options (#1407) * Add ability to turn off devtools on vuex by passing an off options * Swap order of precedence so that we use the options devtools over the vues devtools --- docs/api/README.md | 13 +++++++++++++ src/store.js | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/api/README.md b/docs/api/README.md index 906167686..865e92f63 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -116,6 +116,19 @@ const store = new Vuex.Store({ ...options }) [Details](../guide/strict.md) +### devtools + +- type: `Boolean` + + Turn the devtools on or off for a particular vuex instance. For instance passing false tells the Vuex store to not subscribe to devtools plugin. Useful for if you have multiple stores on a single page. + + ``` js + { + devtools: false + } + ``` + + ## Vuex.Store Instance Properties ### state diff --git a/src/store.js b/src/store.js index b5b083c92..4251eaa73 100644 --- a/src/store.js +++ b/src/store.js @@ -63,7 +63,8 @@ export class Store { // apply plugins plugins.forEach(plugin => plugin(this)) - if (Vue.config.devtools) { + const useDevtools = options.devtools !== undefined ? options.devtools : Vue.config.devtools + if (useDevtools) { devtoolPlugin(this) } }