HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/buyercall/assets/vue/widgets/LayoutMode/layoutmode.vue
<template>
  <div>
    <div class="form-check form-switch mb-3 mt-4">
      <input
        type="checkbox"
        class="form-check-input"
        v-model="layoutMode"
        @change="changeEvent"
      />
      <label class="form-check-label" for="change-mode-switch">{{
        layoutMode ? 'Light mode' : 'Dark mode'
      }}</label>
    </div>
  </div>
</template>


<script>
export default {
  data() {
    return {
      mode: true,
      checked: false,
      layoutMode: true,
    };
  },
  watch: {},
  computed: {},
  methods: {
    changeEvent: function () {
      if (this.layoutMode) {
        sessionStorage.setItem('light_mode', true);
        $('head').append(app_css_theme_light);
      } else {
        sessionStorage.setItem('light_mode', false);
        $('head').append(app_css_theme_dark);
      }
    },
  },
  mounted() {
    if (sessionStorage.getItem('light_mode') == 'false') {
      this.layoutMode = false;
    }
  },
};
</script>