Lift the state up
parent
f3eb9e81f9
commit
ee07d1e70f
|
@ -58,8 +58,6 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
presets: Object.keys(presets),
|
presets: Object.keys(presets),
|
||||||
selectedPrimaryColor: 'noir',
|
|
||||||
selectedSurfaceColor: null,
|
|
||||||
primaryColors: [
|
primaryColors: [
|
||||||
{ name: 'noir', palette: {} },
|
{ name: 'noir', palette: {} },
|
||||||
{ name: 'emerald', palette: { 50: '#ecfdf5', 100: '#d1fae5', 200: '#a7f3d0', 300: '#6ee7b7', 400: '#34d399', 500: '#10b981', 600: '#059669', 700: '#047857', 800: '#065f46', 900: '#064e3b', 950: '#022c22' } },
|
{ name: 'emerald', palette: { 50: '#ecfdf5', 100: '#d1fae5', 200: '#a7f3d0', 300: '#6ee7b7', 400: '#34d399', 500: '#10b981', 600: '#059669', 700: '#047857', 800: '#065f46', 900: '#064e3b', 950: '#022c22' } },
|
||||||
|
@ -248,8 +246,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateColors(type, color) {
|
updateColors(type, color) {
|
||||||
if (type === 'primary') this.selectedPrimaryColor = color.name;
|
if (type === 'primary') {
|
||||||
else if (type === 'surface') this.selectedSurfaceColor = color.name;
|
this.$appState.primary = color.name;
|
||||||
|
} else if (type === 'surface') {
|
||||||
|
this.$appState.surface = color.name;
|
||||||
|
}
|
||||||
|
|
||||||
this.applyTheme(type, color);
|
this.applyTheme(type, color);
|
||||||
},
|
},
|
||||||
|
@ -276,6 +277,12 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
rippleActive() {
|
rippleActive() {
|
||||||
return this.$primevue.config.ripple;
|
return this.$primevue.config.ripple;
|
||||||
|
},
|
||||||
|
selectedPrimaryColor() {
|
||||||
|
return this.$appState.primary;
|
||||||
|
},
|
||||||
|
selectedSurfaceColor() {
|
||||||
|
return this.$appState.surface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,6 +6,8 @@ const $appState = {
|
||||||
install: (Vue, options) => {
|
install: (Vue, options) => {
|
||||||
Vue.config.globalProperties.$appState = reactive({
|
Vue.config.globalProperties.$appState = reactive({
|
||||||
preset: 'Aura',
|
preset: 'Aura',
|
||||||
|
primary: 'noir',
|
||||||
|
surface: null,
|
||||||
darkTheme: false,
|
darkTheme: false,
|
||||||
codeSandbox: false,
|
codeSandbox: false,
|
||||||
sourceType: 'options-api',
|
sourceType: 'options-api',
|
||||||
|
|
Loading…
Reference in New Issue