Home >Web Front-end >JS Tutorial >Code example of additional parameters passed in iView component event

Code example of additional parameters passed in iView component event

不言
不言forward
2019-03-27 09:35:542415browse

The content of this article is about the code example of additional parameters passed in the iview component event. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

<template>
    <Table border :columns="columns6" :data="data5" @on-row-click="(row, index) => { youFunc(row, index , 'params')}"></Table>
</template>
<script>
    export default {
        methods:{
          youFunc(row, index, params) {
            console.log(row, index, params)
          }
        },
        data () {
            return {
                columns6: [
                    {
                        title: 'Date',
                        key: 'date'
                    },
                    {
                        title: 'Name',
                        key: 'name'
                    },
                    {
                        title: 'Age',
                        key: 'age',
                        filters: [
                            {
                                label: 'Greater than 25',
                                value: 1
                            },
                            {
                                label: 'Less than 25',
                                value: 2
                            }
                        ],
                        filterMultiple: false,
                        filterMethod (value, row) {
                            if (value === 1) {
                                return row.age > 25;
                            } else if (value === 2) {
                                return row.age < 25;
                            }
                        }
                    },
                    {
                        title: &#39;Address&#39;,
                        key: &#39;address&#39;,
                        filters: [
                            {
                                label: &#39;New York&#39;,
                                value: &#39;New York&#39;
                            },
                            {
                                label: &#39;London&#39;,
                                value: &#39;London&#39;
                            },
                            {
                                label: &#39;Sydney&#39;,
                                value: &#39;Sydney&#39;
                            }
                        ],
                        filterMethod (value, row) {
                            return row.address.indexOf(value) > -1;
                        }
                    }
                ],
                data5: [
                    {
                        name: 'John Brown',
                        age: 18,
                        address: 'New York No. 1 Lake Park',
                        date: '2016-10-03'
                    },
                    {
                        name: 'Jim Green',
                        age: 24,
                        address: 'London No. 1 Lake Park',
                        date: '2016-10-01'
                    },
                    {
                        name: 'Joe Black',
                        age: 30,
                        address: 'Sydney No. 1 Lake Park',
                        date: '2016-10-02'
                    },
                    {
                        name: 'Jon Snow',
                        age: 26,
                        address: 'Ottawa No. 2 Lake Park',
                        date: '2016-10-04'
                    }
                ],
            }
        }
    }
</script>

This article has ended here. For more exciting content, you can pay attention to the JavaScript Video Tutorial column on the PHP Chinese website!

The above is the detailed content of Code example of additional parameters passed in iView component event. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete