In a form field within the Parent Component, there is a submit button along with a select option. When the User changes the select option, it should pass that value to trigger a method/function in the child component. I want the child function to be automatically updated whenever the User makes changes.
<select>
<option value="www.google.com">google</option>
<option value="www.facebook.com">facebook</option>
<option value="www.twitter.com">twitter</option>
</select>
<button> Submit </button>
When the submit button is pressed, a function will be executed on the Child component.
export default {
name: 'child',
data () {
return {
title: 'Child',
}
},
methods: {
doSomething: function (url) {
var newurl = url;
}
}
}
Therefore, when the button is pressed, the doSomething method will run using the selected value.