1, vue function in the hook function needs to be called to the assignment window.
Mounted () {
// The method Vue spread global object window in
window.updateSocket = this.onSubmit;
},
2, js can be used directly.
<script type="text/javascript">
updateSocket();
</script>