即使我有错误Vue.js,提交表单后模态也会关闭

我使用vuelidate创建了一个验证,但提交表单后,即使我遇到错误,模态也会关闭。我正在将Bootstrap-Vue与VueJs一起使用。如果提交后出现错误,我希望打开模型。

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Configuration
    @Order(1)
    public class SwaggerSecurityConfig extends WebSecurityConfigurerAdapter {
        private final AuthenticationProvider userPassAuthProvider;

        @Autowired
        SwaggerSecurityConfig(UserPassAuthProvider userPassAuthProvider) {
            this.userPassAuthProvider = userPassAuthProvider;
        }

        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.antMatcher("/swagger**").
                    authorizeRequests().
                    antMatchers("/swagger**").authenticated().
                    and().httpBasic().and().csrf().disable();
        }

        @Override
        public void configure(AuthenticationmanagerBuilder auth)
                throws Exception {
            auth.authenticationProvider(userPassAuthProvider);
        }
    }

    @Configuration
    @Order(2)
    public class APISecurityConfig extends WebSecurityConfigurerAdapter {
        private final AuthenticationProvider idAuthProvider;

        @Autowired
        APISecurityConfig(IDAuthProvider idAuthProvider) {
            this.idAuthProvider = idAuthProvider;
        }

        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.antMatcher("/api/v1/**").
                    authorizeRequests().anyRequest().authenticated().
                    and().
                    addFilterBefore(idpAuthenticationFilter(authenticationmanager()),BasicAuthenticationFilter.class).sessionmanagement().
                    and().
                    csrf().disable();
        }

        @Override
        public void configure(AuthenticationmanagerBuilder auth)
                throws Exception {
            auth.authenticationProvider(idAuthProvider);
        }

        IDPAuthenticationFilter idpAuthenticationFilter(Authenticationmanager auth) {
            return new IDPAuthenticationFilter(auth,new OrRequestMatcher(new AntPathRequestMatcher(ApiRouter.API_PATH + "/**",HttpMethod.GET.toString()),new AntPathRequestMatcher(ApiRouter.API_PATH + "/**",HttpMethod.POST.toString()),HttpMethod.DELETE.toString()),new AntPathRequestMatcher("/swagger**",HttpMethod.GET.toString())));
        }
    }
}
jayredie 回答:即使我有错误Vue.js,提交表单后模态也会关闭

我再次阅读了文档,并找到了解决方案。 我添加了这个bvModalEvt.preventDefault()

addCustomer(bvModalEvt) {
    if (this.$v.$invalid) {
        bvModalEvt.preventDefault()
        console.log('Error');
    }else{
...code...
本文链接:https://www.f2er.com/2962980.html

大家都在问