Files
FE_CPONE/test/vuex/one-fo-verification-kris/components/oneFieldVerification.vue
2026-04-27 10:13:31 +07:00

108 lines
2.1 KiB
Vue

<template>
<v-layout>
<v-checkbox
v-model="x_value"
@change="changeLahBrooo"
hide-details class="shrink mr-2"
></v-checkbox>
<v-text-field
:label="__label"
placeholder="Alasan"
outline
:disabled="x_disabled"
:error-messages="is_error ? x_error_messages : ''"
:error_count="is_error ? x_error_count : 0 "
:error=is_error
:hide-details=!x_error
v-model=init_note
></v-text-field>
</v-layout>
</template>
<script>
module.exports = {
props : ['label', 'value', 'is_error', 'note'],
mounted: function() {
this.$nextTick( function() {
this.init_note = this.note;
})
},
data () {
return {
x_value : false,
init_note :""
}
},
methods : {
changeLahBrooo (n, o) {
if (n) this.init_note = "";
var prm = {checked: n, note: this.init_note};
this.$emit('x_change',prm);
console.log("emit x_change");
// console.log("note = " + this.x_ne)
}
},
computed : {
__label () {
if (this.label)
return this.label;
return "";
},
x_disabled () {
// return false;
return this.x_value;
},
x_error () {
if (!this.x_value && this.x_note.length < 1)
return true;
else {
// this.x_note = "";
return false;
}
},
x_error_count () {
// return 0;
if (this.x_error)
return 1;
return 0;
},
x_error_messages () {
if (this.x_error)
return ["Harus diisi"];
return [];
},
x_note: {
set: function(val) {
this.init_note = val;
},
get: function(){
if (this.init_note)
return this.init_note;
return "";
}
}
}
}
</script>