Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close triggers page reload #5

Open
kermorgant opened this issue Jul 1, 2017 · 1 comment
Open

close triggers page reload #5

kermorgant opened this issue Jul 1, 2017 · 1 comment

Comments

@kermorgant
Copy link

Hi,

clicking on the close button trigger page reload (perhaps because I have a form in my template).

Would be nice to prevent submit on the click (I do it in the action). IIRC, it should be possible by replacing @click by @click.prevent

@AlbinoDrought
Copy link
Contributor

Hey,

Are you able to post an example here (possibly the full component file)? I am not able to reproduce this.

Here is a component I tried:

<template>
  <div>
    <modal :showModal="visible" :closeAction="toggle">
      <form slot="body" action="http://example.com">
        <input type="text">
        <input type="submit">
      </form>
    </modal>
    <button type="btn btn-default" @click="toggle">Show</button>
  </div>
</template>

<script>
import Modal from 'modal-vue';

export default {
  components: {
    Modal,
  },
  data() {
    return {
      visible: false,
    };
  },
  methods: {
    toggle() {
      this.visible = !this.visible;
    },
  },
};
</script>

My results:

Clicking the "submit" button sends the browser to the action url, as expected. Clicking the close button performs the closeAction and does not invoke submit, as expected.

Above behaviour also remains the same when no closeAction is specified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants