首頁 > web前端 > js教程 > 主體

iview元件事件額外傳遞參數的程式碼範例

不言
發布: 2019-03-27 09:35:54
轉載
2399 人瀏覽過

這篇文章帶給大家的內容是關於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
作者最新文章
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板