vue+element 点击按钮后 导致 刷新页面 致url中拼接 ? 或者拼接参数

https://blog.csdn.net/sinat_37255207/article/details/88917162

element 自己的<el-form></el-form>标签中 中自带的按钮是

<el-button type="primary" class="fl_button" @click="onSubmit">保存</el-button>

如果用普通的button标签 点击点击事件的时候  注意冒泡事件   必须阻止一下

 <button type="primary" @click.prevent="save()" >&nbsp;&nbsp;保存&nbsp;&nbsp;</button>
//也可以不用button 用div 或者 span 当按钮用 就不会触发冒泡事件了 


<el-form>
<button type="primary" @click.prevent="save()" >&nbsp;&nbsp;保存&nbsp;&nbsp;</button>
</el-form>

<el-form>
<span type="primary" @click="save()" >&nbsp;&nbsp;保存&nbsp;&nbsp;</span>
</el-form>


...

猜你喜欢

转载自www.cnblogs.com/tianmiaogongzuoshi/p/10628566.html