Vue.js axios method mounts undefined; v-for does not work – WordPress page

I am calling Vue.js using a shortcode on a WordPress page.

pl2010_vue_init_directory = pl2010_vue_init_directory || (function(ctx) {
new Vue(
  el: '#'+ctx.el,
  data: {
    errorMsg: "",
    successMsg: "",
    showAddModal: false,
    showEditModal: false,
    showDeleteModal: false,
    listings: [],
    newListing: {name: "",tel1: "",email1: ""},
    currentListing: {}
  mounted: function(){
    var test = this.getAllListings();
    console.log("Start Mounting...");
    console.log("End Mounting...");
  methods: {
    async getAllListings(){
      console.log("Method 2");
      .then((response) => {
        this.listings =;
        return this.listings;

NOTE: I have updated the "getAllListings()" function. I am now returned the correct number of rows but they are all blank. The "v-for" loop has something in it but I cannot output the values.

    <tr class="text-center" v-for="listing in listings">
      <td>{{ }}</td>
      <td>{{ }}</td>
      <td>{{ listing.tel1 }}</td>
      <td>{{ listing.email1 }}</td>
      <td><a href="#" class="text-success" @click="showEditModal=true"><i class="fas fa-edit"></i></a></td>
      <td><a href="#" class="text-danger" @click="showDeleteModal=true"><i class="fas fa-trash-alt"></i></a></td>

How can I output the values and not just the blank rows?

Thank you!

18 thoughts on “Vue.js axios method mounts undefined; v-for does not work – WordPress page”

Leave a Comment