binggle
11 months ago
5414
3
Vue

[Vue warn]: Error in v-on handler: "TypeError: getlist_charge is not a function" ??

Posted 11 months ago by binggle

hi . I just use blade and vuejs script in same php file.

it vomit errors following.

[Vue warn]: Property or method "getlist_charge" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property

[Vue warn]: Error in v-on handler: "TypeError: getlist_charge is not a function"

vue.js:1897 TypeError: getlist_charge is not a function at click (eval at createFunction

Can someone check my codes ?


@php 

$statuss = [
    '1' =>'all',
    '2'=>'waiting',
    '3'=>'done'
];
@endphp 

<div id="main">
     <div class="card-body">
    CHARGES @{{  brand }}

        @foreach( $statuss as $key=>$status )
            <button class="btn btn-sm btn-sm" :class="status_charge=='{{ $key }}' ? 'btn-info' : 'btn-success'" @click="getlist_charge('{{ $key }}')">
            {{  $status }}
            </button>
        @endforeach 
    </div>
</div>


<script>


const main = new Vue({
  el: '#main',
  data() {
    return {
        brand: '1234', 
    }
  },
  method: {
    getlist_charge : function( div) {
        alert( div );
        
    }

  }
})
 

</script> 




brand display '1234' correct ;

TIA

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