router-link会阻止click事件(只用@click不用@click.native,事件是不会触发的)
//以下addUserName点击函数无效
<router-link to="/Home" @click="addUserName">Go to the Home</router-link>
解决方法:将@click改为@click.native
//以下用法就好了啦
<router-link to="/Home" @click.native="addUserName">Go to the Home</router-link>