当button按钮在form表单中,没有添加type属性时,默认为提交按钮,会自动刷新页面。 两种解决办法: 1. 将button按钮放在form表单外面。 2. 添加button按钮的type属性为button。