I'm currently working on creating a login button within a single-file-component using Vue.js in my Rails application with a Vue.js front-end. The purpose of this button is to redirect users to an external login page when clicked.
I am wondering how I can incorporate an image as the button itself. My assumption is that I would need to utilize v-on:click
for the redirection functionality, but I am unsure how to proceed from there.
At the moment, the code I have displays a static button that includes the path to an image like
img(src="../assets/img/login_button.png")
. Clicking on this button does not display the actual image as intended. Instead, only the path is visible.
// LoginButton.vue
<template lang="pug">
#login-button
<button v-on:click="redirect_to_login">img(src="../assets/img/login_button.png")</button>
</template>
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator';
@Component
export default class LoginButton extends Vue{
redirect_to_login():void{ // This method has not been implemented yet
}
}
</script>