PHP Classes

File: resources/js/components/IndexField.vue

Recommend this page to a friend!
  Packages of Naif Alshaye   Laravel Nova Toggle Switch   resources/js/components/IndexField.vue   Download  
File: resources/js/components/IndexField.vue
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Laravel Nova Toggle Switch
Provides a toggle control to use in Laravel Nova
Author: By
Last change: Works with readonly and disabled, Specifi true and false colors in details and index view
Date: 8 months ago
Size: 829 bytes
 

Contents

Class file image Download
<template> <span class="dot_on" v-if="field.value === 1" :style="trueStyles()"></span> <span class="dot_off" v-else-if="field.value === 0" :style="falseStyles()"></span> </template> <script> export default { props: ['resourceName', 'field'], data() { return []; }, methods: { trueStyles() { if (typeof this.field.on_color != 'undefined') { return { "background-color": this.field.on_color }; } else { return { "background-color": "green", }; } }, falseStyles() { if (typeof this.field.off_color != 'undefined') { return { "background-color": this.field.off_color }; } else { return { "background-color": "gray", }; } } }, mounted() { } } </script>