36 lines
823 B
Vue
36 lines
823 B
Vue
<template>
|
|
<b-field class="mb-0 pb-0 mt-3">
|
|
<b-checkbox v-model="recordar">Recordar</b-checkbox>
|
|
</b-field>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
props: {
|
|
nombreVariable: { typeof: String, required: true, default: '' },
|
|
variablePadre: { typeof: Number, required: true, default: 0 },
|
|
},
|
|
data: () => {
|
|
return { recordar: false }
|
|
},
|
|
watch: {
|
|
recordar() {
|
|
if (!this.recordar) localStorage.removeItem(this.nombreVariable)
|
|
else {
|
|
if (this.variablePadre)
|
|
localStorage.setItem(this.nombreVariable, this.variablePadre)
|
|
}
|
|
},
|
|
variablePadre() {
|
|
if (this.recordar)
|
|
localStorage.setItem(this.nombreVariable, this.variablePadre)
|
|
},
|
|
},
|
|
created() {
|
|
if (this.variablePadre) this.recordar = true
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped></style>
|