Skip to content

[MdTable] emitting @md-selected with no value #1559

Closed
@emman27

Description

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.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions