Alwaysblue
Alwaysblue

Reputation: 11850

Loading Image using Dot operator

I want to load image using dot operator.

Consider this as my image url

  <img src={{GET_PROFILE_DATA.googleProfileData.fullName}} alt="profile" class="home-screen-profile-image">

Notice weird looking src here

src={{GET_PROFILE_DATA.googleProfileData.fullName}} 

This is coming from

<script>
import { mapGetters } from "vuex";
export default {
  name: "Profile",
  computed: {
    ...mapGetters(["GET_PROFILE_DATA"])
  }
};
</script>

[Question:] How to load image using dot operator?

Upvotes: 0

Views: 38

Answers (1)

Sebastian
Sebastian

Reputation: 1722

You need to bind src to your property using :src="property" or v-bind:src="property":

  <img :src="GET_PROFILE_DATA.googleProfileData.fullName" alt="profile" class="home-screen-profile-image">

(Note: No curly braces)

See Vue Documentation for more details.

Upvotes: 1

Related Questions