A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuematerial/vue-material/issues/1559 below:

[MdTable] emitting @md-selected with no value · Issue #1559 · vuematerial/vue-material · GitHub

Steps to reproduce

Using vue-material@1.0.0-beta-8, with the following code.

<template>
  <div>
    <md-table md-card v-model="lists" v-if="lists.length !== 0"  @md-selected="onSelect">
      <md-table-row slot="md-table-row" slot-scope="{ item }" md-selectable="single">
        <md-table-cell md-label="Name">{{ item.name }}</md-table-cell>
      </md-table-row>
    </md-table>
  </div>
</template>

<script>
import getLists from '@/api';

export default {
  data() {
    return {
      lists: [],
    };
  },
  async created() {
    try {
      this.lists = await getLists();
    } catch (err) {
      console.log(err)
    }
  },
  methods: {
    onSelect(item) {
      console.log(item);
    },
  },
};
</script>
Which browser?

Multiple (Chrome 64, Firefox)

What is expected & What is actually happening?

onSelect should only be called when something is clicked. However, it is being called every time the component appears (not sure created or mounted, tbh), and called with undefined.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4