Blame view

examples/routers/table.vue 7.16 KB
548eac43   梁灏   fixed #1387 and u...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
  <!--<template>-->
      <!--<div>-->
          <!--<Table-->
                  <!--width="500"-->
                  <!--border-->
                  <!--highlight-row-->
                  <!--:columns="columns2"-->
                  <!--@on-selection-change="change2"-->
                  <!--:data="data3"></Table>-->
          <!--<Button @click="addData">添加数据</Button>-->
      <!--</div>-->
  <!--</template>-->
  <!--<script>-->
      <!--import test from '../components/test.vue';-->
      <!--export default {-->
          <!--data () {-->
              <!--return {-->
                  <!--columns2: [-->
  <!--//                    {-->
  <!--//                        type: 'selection',-->
  <!--//                        width: 60,-->
  <!--//                        align: 'center'-->
  <!--//                    },-->
                      <!--{-->
                          <!--title: '姓名',-->
                          <!--key: 'name',-->
                          <!--width: 100,-->
  <!--//                        sortable: true,-->
                          <!--fixed: 'right',-->
                          <!--render: (h, params) => {-->
                              <!--return h('div', [-->
                                  <!--h('Button', {-->
                                      <!--props: {-->
                                          <!--type: 'primary',-->
                                          <!--size: 'small'-->
                                      <!--},-->
                                      <!--on: {-->
                                          <!--click: this.edit-->
                                      <!--},-->
                                  <!--}, '修改')-->
                              <!--]);-->
                          <!--}-->
                      <!--},-->
                      <!--{-->
                          <!--title: '年龄',-->
                          <!--key: 'age',-->
                          <!--sortable: true,-->
  <!--//                        width: 100-->
                      <!--},-->
                      <!--{-->
                          <!--title: '省份',-->
                          <!--key: 'province',-->
                          <!--sortable: true,-->
  <!--//                        fixed: 'right',-->
  <!--//                        width: 100-->
                      <!--},-->
  <!--//                    {-->
  <!--//                        title: '市区',-->
  <!--//                        key: 'city',-->
  <!--//                        width: 100-->
  <!--//                    },-->
  <!--//                    {-->
  <!--//                        title: '地址',-->
  <!--//                        key: 'address',-->
  <!--//                        width: 200-->
  <!--//                    },-->
  <!--//                    {-->
  <!--//                        title: '邮编',-->
  <!--//                        key: 'zip',-->
  <!--//                        width: 100-->
  <!--//                    },-->
  <!--//                    {-->
  <!--//                        title: '操作',-->
  <!--//                        key: 'action',-->
  <!--//                        fixed: 'right',-->
  <!--//                        width: 120,-->
  <!--//                        render: (h, params) => {-->
  <!--//                            return h(test);-->
  <!--//                        }-->
  <!--//                    }-->
                  <!--],-->
                  <!--data3: [-->
  <!--//                    {-->
  <!--//                        name: '王小明',-->
  <!--//                        age: 18,-->
  <!--//                        address: '北京市朝阳区芍药居',-->
  <!--//                        province: '北京市',-->
  <!--//                        city: '朝阳区',-->
  <!--//                        zip: 100000-->
  <!--//                    },-->
  <!--//                    {-->
  <!--//                        name: '张小刚',-->
  <!--//                        age: 25,-->
  <!--//                        address: '北京市海淀区西二旗',-->
  <!--//                        province: '北京市',-->
  <!--//                        city: '海淀区',-->
  <!--//                        zip: 100000-->
  <!--//                    },-->
  <!--//                    {-->
  <!--//                        name: '李小红',-->
  <!--//                        age: 30,-->
  <!--//                        address: '上海市浦东新区世纪大道',-->
  <!--//                        province: '上海市',-->
  <!--//                        city: '浦东新区',-->
  <!--//                        zip: 100000-->
  <!--//                    },-->
  <!--//                    {-->
  <!--//                        name: '周小伟',-->
  <!--//                        age: 26,-->
  <!--//                        address: '深圳市南山区深南大道',-->
  <!--//                        province: '广东',-->
  <!--//                        city: '南山区',-->
  <!--//                        zip: 100000-->
  <!--//                    }-->
                  <!--]-->
              <!--}-->
          <!--},-->
          <!--methods: {-->
              <!--change1 (d, l) {-->
  <!--//                console.log(d)-->
  <!--//                console.log(l)-->
              <!--},-->
              <!--change2 (d, l) {-->
                  <!--console.log(d);-->
                  <!--console.log(l);-->
              <!--},-->
              <!--addData () {-->
                  <!--this.data3.push({-->
                      <!--name: '周小伟',-->
                      <!--age: 26,-->
                      <!--address: '深圳市南山区深南大道',-->
                      <!--province: '广东',-->
                      <!--city: '南山区',-->
                      <!--zip: 100000-->
                  <!--})-->
              <!--}-->
          <!--}-->
      <!--}-->
  <!--</script>-->
  
2cb8a6d9   梁灏   commit Table comp...
141
  <template>
548eac43   梁灏   fixed #1387 and u...
142
143
144
145
      <div>
          <i-table :data="dtData" :height="400" :columns="dtCols" border highlight-row></i-table>
          <Button type="ghost" @click="addData"> add data</Button>
      </div>
2cb8a6d9   梁灏   commit Table comp...
146
147
  </template>
  <script>
2cb8a6d9   梁灏   commit Table comp...
148
      export default {
548eac43   梁灏   fixed #1387 and u...
149
150
151
152
          data(){
              return{
                  dtData:[],
                  dtCols:[
10d3a323   Aresn   fixed #1011
153
                      {
8b530b1c   梁灏   fixed #1342
154
155
156
                          type: 'selection',
                          width: 60,
                          align: 'center'
10d3a323   Aresn   fixed #1011
157
                      },
2404849c   leonine   合并原作者更新
158
                      {
548eac43   梁灏   fixed #1387 and u...
159
                          title: '分类名称',
8b530b1c   梁灏   fixed #1342
160
                          key: 'name',
548eac43   梁灏   fixed #1387 and u...
161
                          sortable: true
8b530b1c   梁灏   fixed #1342
162
163
164
                      },
                      {
                          title: '操作',
8b530b1c   梁灏   fixed #1342
165
166
167
                          fixed: 'right',
                          width: 120,
                          render: (h, params) => {
548eac43   梁灏   fixed #1387 and u...
168
169
170
171
172
173
174
175
176
177
178
                              return h('div', [
                                  h('Button', {
                                      props: {
                                          type: 'primary',
                                          size: 'small'
                                      },
                                      on: {
                                          click: this.edit
                                      },
                                  }, '修改')
                              ]);
8b530b1c   梁灏   fixed #1342
179
180
                          }
                      }
8b530b1c   梁灏   fixed #1342
181
                  ]
2cb8a6d9   梁灏   commit Table comp...
182
              }
b0f1c61f   Rijn   add a event @on-s...
183
          },
8b530b1c   梁灏   fixed #1342
184
          methods: {
548eac43   梁灏   fixed #1387 and u...
185
186
187
188
              addData () {
                  this.dtData.push({
                      name: '发送到附件是'
                  })
b0f1c61f   Rijn   add a event @on-s...
189
              }
2cb8a6d9   梁灏   commit Table comp...
190
191
          }
      }
548eac43   梁灏   fixed #1387 and u...
192
  </script>