adhik13th
3 months ago
434
4
Vue

input using vue js

Posted 3 months ago by adhik13th

I am first using input in vue js . this input have structure like this

                induk_id:'',
                nama_barang:'',
                qtt:'',
                satuan:'',
                harga:'',
                harga_total:'',
                keterangan:'',
                status:'Aktif',

this induk_id is foreign key on another table , but i dont know how to pass this induk_id on this vue . i use laravel vue js and this is controller and route

public function input_detail($id)
{
    $pencairan = IndukPencairan::findOrFail($id);
    if (!$pencairan)
    abort(404);
    
    return view('pengadaan.inputdetail',['pencairan' => $pencairan]);
}

this controller on laravel blade i can pass like $pencairan->id for this induk_id , but how i can pass this on vue ?

and its my route

 Route::get('input_detail/{id}', '[email protected]_detail')->name('input_detail');

and its my export default

 export default {
    data(){
        return{     
            count: 0,
            userData:[{
                induk_id:'',
                nama_barang:'',
                qtt:'',
                satuan:'',
                harga:'',
                harga_total:'',
                keterangan:'',
                status:'Aktif',
            }],
        }
    },
    
    components:{
       
    },
    methods:{
        submit() {
            this.errors = {};
            axios.post('/pengadaan/store_induk_pencairan', this.userData).then(response => {
                window.location = response.data.redirect;
            }).catch(error => {
                if (error.response.status === 422) {
                this.errors = error.response.data.errors || {};
                }
            });
            },
         AddField: function () {
             this.userData.push({ induk_id: '',nama_barang: ''  ,qtt: '' ,satuan: '',harga: '' ,harga_total: '',
             keterangan: '' ,status: 'Aktif',
             });
              }
            
    },

my question is how i retrieve induk_id in vue js ?

Please sign in or create an account to participate in this conversation.