@@ -286,33 +286,40 @@ export default {
286286 }
287287 }
288288 }
289+ },
290+ rootColor : function () {
291+ let root = document .querySelector (' :root' )
292+ if (this .def .buttonsSettings .controlStyle === ' square' ) {
293+ root .style .setProperty (' --controlStyle' , ' 0' )
294+ } else if (this .def .buttonsSettings .controlStyle === ' circle' ) {
295+ root .style .setProperty (' --controlStyle' , ' 50%' )
296+ } else {
297+ root .style .setProperty (' --controlStyle' , ' 4px' )
298+ }
299+ root .style .setProperty (' --pageButtonsBackground' , this .def .buttonsSettings .allPageButtonsStyle .background )
300+ root .style .setProperty (' --pageButtonsBorderColor' , this .def .buttonsSettings .allPageButtonsStyle .borderColor )
301+ root .style .setProperty (' --pageButtonsColor' , this .def .buttonsSettings .allPageButtonsStyle .color )
302+ root .style .setProperty (' --pageButtonsFontFamily' , this .def .buttonsSettings .allPageButtonsStyle .fontFamily )
303+ root .style .setProperty (' --pageButtonsBackgroundHover' , this .def .buttonsSettings .allPageButtonsStyle .backgroundHover )
304+ root .style .setProperty (' --pageButtonsBorderColorHover' , this .def .buttonsSettings .allPageButtonsStyle .borderColorHover )
305+ root .style .setProperty (' --pageButtonsColorHover' , this .def .buttonsSettings .allPageButtonsStyle .colorHover )
306+ root .style .setProperty (' --pageButtonBackgroundActive' , this .def .buttonsSettings .currentPageButtonStyle .backgroundActive )
307+ root .style .setProperty (' --pageButtonBorderColorActive' , this .def .buttonsSettings .currentPageButtonStyle .borderColorActive )
308+ root .style .setProperty (' --pageButtonColorActive' , this .def .buttonsSettings .currentPageButtonStyle .colorActive )
309+ root .style .setProperty (' --controlDotsColor' , this .def .dotsSettings .controlDotsColor )
310+ root .style .setProperty (' --arrowStyleColorHover' , this .def .arrowsSettings .arrowStyleColorHover )
289311 }
290312 },
291313 beforeMount () {
292314 document .addEventListener (' keydown' , this .keydown )
293- console .log (this .def .pageStarted )
294315 this .curIndex = this .def .pageStarted - 1
295316 this .$set (this .settings .array_data [this .curIndex ], ' active' , true )
296- let root = document .querySelector (' :root' )
297- if (this .def .buttonsSettings .controlStyle === ' square' ) {
298- root .style .setProperty (' --controlStyle' , ' 0' )
299- } else if (this .def .buttonsSettings .controlStyle === ' circle' ) {
300- root .style .setProperty (' --controlStyle' , ' 50%' )
301- } else {
302- root .style .setProperty (' --controlStyle' , ' 4px' )
317+ this .rootColor ()
318+ },
319+ watch: {
320+ ' def ' : function (oldVal , newVal ) {
321+ this .rootColor ()
303322 }
304- root .style .setProperty (' --pageButtonsBackground' , this .def .buttonsSettings .allPageButtonsStyle .background )
305- root .style .setProperty (' --pageButtonsBorderColor' , this .def .buttonsSettings .allPageButtonsStyle .borderColor )
306- root .style .setProperty (' --pageButtonsColor' , this .def .buttonsSettings .allPageButtonsStyle .color )
307- root .style .setProperty (' --pageButtonsFontFamily' , this .def .buttonsSettings .allPageButtonsStyle .fontFamily )
308- root .style .setProperty (' --pageButtonsBackgroundHover' , this .def .buttonsSettings .allPageButtonsStyle .backgroundHover )
309- root .style .setProperty (' --pageButtonsBorderColorHover' , this .def .buttonsSettings .allPageButtonsStyle .borderColorHover )
310- root .style .setProperty (' --pageButtonsColorHover' , this .def .buttonsSettings .allPageButtonsStyle .colorHover )
311- root .style .setProperty (' --pageButtonBackgroundActive' , this .def .buttonsSettings .currentPageButtonStyle .backgroundActive )
312- root .style .setProperty (' --pageButtonBorderColorActive' , this .def .buttonsSettings .currentPageButtonStyle .borderColorActive )
313- root .style .setProperty (' --pageButtonColorActive' , this .def .buttonsSettings .currentPageButtonStyle .colorActive )
314- root .style .setProperty (' --controlDotsColor' , this .def .dotsSettings .controlDotsColor )
315- root .style .setProperty (' --arrowStyleColorHover' , this .def .arrowsSettings .arrowStyleColorHover )
316323 }
317324}
318325 </script >
0 commit comments