| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 | <!DOCTYPE html><html><head>    <meta charset="utf-8">    <title>iview example</title>    <link rel="stylesheet" type="text/css" href="http://unpkg.com/iview/dist/styles/iview.css">    <script type="text/javascript" src="http://vuejs.org/js/vue.min.js"></script>    <script type="text/javascript" src="http://unpkg.com/iview/dist/iview.min.js"></script>	<style>	#app{padding: 32px;}	</style></head><body><div id="app">     <i-table border :columns="columns7" :data="data6"></i-table></div><script>       var Main = {        data () {            return {                columns7: [                    {                        title: 'Name',                        key: 'name',                        render: (h, params) => {                            return h('div', [                                h('Icon', {                                    props: {                                        type: 'person'                                    }                                }),                                h('strong', params.row.name)                            ]);                        }                    },                    {                        title: 'Age',                        key: 'age'                    },                    {                        title: 'Address',                        key: 'address'                    },                    {                        title: 'Action',                        key: 'action',                        width: 150,                        align: 'center',                        render: (h, params) => {                            return h('div', [                                h('Button', {                                    props: {                                        type: 'primary',                                        size: 'small'                                    },                                    style: {                                        marginRight: '5px'                                    },                                    on: {                                        click: () => {                                            this.show(params.index)                                        }                                    }                                }, 'View'),                                h('Button', {                                    props: {                                        type: 'error',                                        size: 'small'                                    },                                    on: {                                        click: () => {                                            this.remove(params.index)                                        }                                    }                                }, 'Delete')                            ]);                        }                    }                ],                data6: [                    {                        name: 'John Brown',                        age: 18,                        address: 'New York No. 1 Lake Park'                    },                    {                        name: 'Jim Green',                        age: 24,                        address: 'London No. 1 Lake Park'                    },                    {                        name: 'Joe Black',                        age: 30,                        address: 'Sydney No. 1 Lake Park'                    },                    {                        name: 'Jon Snow',                        age: 26,                        address: 'Ottawa No. 2 Lake Park'                    }                ]            }        },        methods: {            show (index) {                this.$Modal.info({                    title: 'User Info',                    content: `Name:${this.data6[index].name}<br>Age:${this.data6[index].age}<br>Address:${this.data6[index].address}`                })            },            remove (index) {                this.data6.splice(index, 1);            }        }    }var Component = Vue.extend(Main)new Component().$mount('#app')</script></body></html>
 |