手动触发html校验submit, 校验不通过不提交

 https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement

this.editing.dom.container.querySelector('form input[type="submit"]').click();
    let inValid = true;
    [].forEach.call(this.editing.dom.container.querySelectorAll('form input[required]'), (input) => {
        if (input.checkValidity() === false) {
            inValid = false;
        }
    });
    if (!inValid) {
        return;
    }

  

posted @ 2020-06-04 14:42  Loki-Liu  阅读(773)  评论(0编辑  收藏  举报