1
resposta

erro event target value

O que acontece que ao digitar o input não esta "definido"?

<template>
  <div class="md-layout md-gutter">
    <div class="md-layout-item">
      <md-field>
        <label>{{searchLabelTitle}}</label>
        <md-input v-on:input="search = $event.target.value"></md-input>
      </md-field>
    </div>
    {{search}}
  </div>
</template>

<script>
export default {

  props:['searchLabelTitle'],
  data(){
    return{
            search: ''
    }
  }

}
</script>

<style>
</style>


vue.esm.js?efeb:610 [Vue warn]: Error in event handler for "input": "TypeError: Cannot read property 'value' of undefined"

found in

---> <MdInput> at src/components/MdField/MdInput/MdInput.vue
       <MdField> at src/components/MdField/MdField.vue
         <Search> at src/components/shared/painel/Search.vue
           <MdToolbar> at src/components/MdToolbar/MdToolbar.vue
             <MdAppToolbar> at src/components/MdApp/MdAppToolbar.vue
               <MdAppSideDrawer> at src/components/MdApp/MdAppSideDrawer.vue
                 <HelloWorld> at src/components/HelloWorld.vue
                   <App> at src/App.vue
                     <Root>
warn @ vue.esm.js?efeb:610
logError @ vue.esm.js?efeb:1824
globalHandleError @ vue.esm.js?efeb:1819
handleError @ vue.esm.js?efeb:1808
Vue.$emit @ vue.esm.js?efeb:2650
e.(anonymous function) @ backend.js:1
localValue @ vue-material.js?2e0c:1199
run @ vue.esm.js?efeb:3354
flushSchedulerQueue @ vue.esm.js?efeb:3096
(anonymous) @ vue.esm.js?efeb:1925
flushCallbacks @ vue.esm.js?efeb:1844
Promise.then (async)
microTimerFunc @ vue.esm.js?efeb:1892
nextTick @ vue.esm.js?efeb:1938
queueWatcher @ vue.esm.js?efeb:3188
update @ vue.esm.js?efeb:3330
notify @ vue.esm.js?efeb:721
reactiveSetter @ vue.esm.js?efeb:1046
proxySetter @ vue.esm.js?efeb:3417
(anonymous) @ vue-material.js?2e0c:1153
(anonymous) @ vue.esm.js?efeb:1925
flushCallbacks @ vue.esm.js?efeb:1844
vue.esm.js?efeb:1828 TypeError: Cannot read property 'value' of undefined
    at input (eval at ./node_modules/vue-loader/lib/template-compiler/index.js?{"id":"data-v-ac405400","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/shared/painel/Search.vue (app.js:973), <anonymous>:18:46)
    at VueComponent.invoker (vue.esm.js?efeb:2128)
    at VueComponent.Vue.$emit (vue.esm.js?efeb:2648)
    at VueComponent.e.(:8080/anonymous function) [as $emit] (chrome-extension://nhdogjmejiglipccpnnnanhbledajbpd/build/backend.js:1:17291)
    at VueComponent.localValue (vue-material.js?2e0c:1199)
    at Watcher.run (vue.esm.js?efeb:3354)
    at flushSchedulerQueue (vue.esm.js?efeb:3096)
    at Array.eval (vue.esm.js?efeb:1925)
    at flushCallbacks (vue.esm.js?efeb:1844)
1 resposta

Fala aí PullUP, tudo bem? Esse componente md-input foi feito por você? O problema está nele, seu evento de input deve estar no input nativo e não nesse componente.

<input @input="msg = $event.target.value" type="text">

E com um h1, podemos ver a mensagem que é digitada no input:

<h1>{{ msg }}</h1>

Espero ter ajudado.