Skip to content

Instantly share code, notes, and snippets.

@orekyuu
Created December 7, 2018 07:03
Show Gist options
  • Save orekyuu/a0624502eefc6ebfc66dbe6f155b2442 to your computer and use it in GitHub Desktop.
Save orekyuu/a0624502eefc6ebfc66dbe6f155b2442 to your computer and use it in GitHub Desktop.
inside
<template>
<form action="xxxx" method="post">
<input type="hidden" name="_csrf" :value="csrf">
...
</form>
</template>
<script>
export default {
data: function () {
return {
csrf: ''
};
},
created: function () {
//csrfトークンをmetaタグから持ってきてフォームに埋め込む
this.csrf = document.getElementsByName('csrfToken')[0].getAttribute('content');
}
}
</script>
<style lang="scss">
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment