首页 > web前端 > js教程 > iview组件事件额外传递参数的代码示例

iview组件事件额外传递参数的代码示例

不言
发布: 2019-03-27 09:35:54
转载
2423 人浏览过

本篇文章给大家带来的内容是关于iview组件事件额外传递参数的代码示例,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

<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>
登录后复制

本篇文章到这里就已经全部结束了,更多其他精彩内容可以关注PHP中文网的JavaScript视频教程栏目!

以上是iview组件事件额外传递参数的代码示例的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:segmentfault.com
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
作者最新文章
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板