Pass functions from child to parent in Templates Vue

0

Hello in this function beforeTabSwitch: function() , how can I simulate a submit and call me the function that is in a template vue son, it is all in one, but I had to separate each form within a tab, this I have in my template son <form @submit="formSubmit"> and this would be the father .

Vue.use(VueFormWizard)
new Vue({
 el: '#app',
 methods: {
  onComplete: function(){
      alert('Yay. Done!');
   },
   beforeTabSwitch: function(){
     alert("This is called before switchind tabs")
     return true;
   }
  }
})
<link href="https://rawgit.com/cristijora/vue-form-wizard/master/dist/vue-form-wizard.min.css" rel="stylesheet"/>
<script src="https://rawgit.com/cristijora/vue-form-wizard/master/dist/vue-form-wizard.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<div>
        <form-wizard @on-complete="onComplete" 
                      shape="tab"
                      color="#9b59b6">
            <tab-content title="Personal details"
                         icon="ti-user" :before-change="beforeTabSwitch">
              My first tab content
            </tab-content>
            <tab-content title="Additional Info"
                         icon="ti-settings">
              My second tab content
            </tab-content>
            <tab-content title="Last step"
                         icon="ti-check">
              Yuhuuu! This seems pretty damn simple
            </tab-content>
        </form-wizard>
 </div>
</div>

How would you call that function and get the answer that is a json?

    
asked by Alexa 28.12.2018 в 00:11
source

0 answers