export default {
methods: {
/**
*表单提交定位
*
* @return {*}
*/
mixinsFormScrollIntoView() {
this.$nextTick(() => {
const isError = document.getElementsByClassName('is-error');
isError[0].scrollIntoView({
// 滚动到指定节点
// 值有start,center,end,nearest,当前显示在视图区域中间
block: 'center',
// 值有auto、instant,smooth,缓动动画(当前是慢速的)
behavior: 'smooth'
});
});
}
}
};
submit() {
// 自组件提交数据
Promise.all([
result1,
result2,
result3
]).then(([result1, result2, result3]) => {
this.$confirm(`确定要提交吗?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
try {
const params = {
...result1,
...result2,
...result3
};
// 请求接口
await this.xxx(params);
} catch (error) {
console.log(error);
}
});
}).catch(() => {
this.mixinsFormScrollIntoView();
});
},