|
1 | 1 | <template> |
2 | 2 | <div> |
3 | | - <p>首页内容</p> |
| 3 | + <p id="test2">首页内容</p> |
| 4 | + <div id="test">{{message}}</div> |
| 5 | + <table-box ref="tableBox" :url="table.url" :columns="table.columns" :key-name="table.keyName" :parse-data="table.parseData" :data="table.data" :multi-select="table.multiSelect"> |
| 6 | + |
| 7 | + <tr slot="row" slot-scope="props"> |
| 8 | + <td class="tc">{{props.index}}</td> |
| 9 | + <td><img :src="props.item.avatar" width="50" height="50"/></td> |
| 10 | + <td>{{props.item.nickname}}</td> |
| 11 | + <td>{{props.item.province}}-{{props.item.city}}</td> |
| 12 | + <td class="tc">{{props.item.sex}}</td> |
| 13 | + <td>{{props.item.created_at}}</td> |
| 14 | + </tr> |
| 15 | + |
| 16 | + |
| 17 | + </table-box> |
4 | 18 | </div> |
5 | 19 | </template> |
6 | 20 |
|
7 | 21 | <script> |
8 | 22 |
|
| 23 | + import TableBox from '../../components/mod/TableBox' |
| 24 | +
|
9 | 25 | import authorize from '../../utils/base/authorize' |
10 | 26 | import api from '../../utils/config/api' |
11 | 27 | import network from '../../utils/base/network' |
12 | 28 | import {SET_BREADCRUMB} from "../../store/mutation-types"; |
13 | 29 |
|
14 | 30 | export default { |
15 | 31 | name: 'Index', |
16 | | - components: {}, |
| 32 | + components: {TableBox}, |
17 | 33 |
|
18 | 34 | data:function () { |
19 | 35 | return { |
| 36 | + message:'ceshi', |
| 37 | + table:{ |
| 38 | + url:api.member_index, |
| 39 | + multiSelect:false, |
| 40 | + keyName:'id', |
| 41 | + columns:[ |
| 42 | + { |
| 43 | + title:"头像", |
| 44 | + field:"avatar", |
| 45 | + width:'80' |
| 46 | + }, |
| 47 | + { |
| 48 | + title:"昵称", |
| 49 | + field:"nickname", |
| 50 | + width:'' |
| 51 | + }, |
| 52 | + { |
| 53 | + title:"所在地区", |
| 54 | + field:"province", |
| 55 | + width:'' |
| 56 | + }, |
| 57 | + { |
| 58 | + title:"性别", |
| 59 | + field:"sex", |
| 60 | + width:'80' |
| 61 | + }, |
| 62 | + { |
| 63 | + title:"注册时间", |
| 64 | + field:"created_at", |
| 65 | + width:'160' |
| 66 | + }, |
20 | 67 |
|
21 | | -
|
| 68 | + ], |
| 69 | + parseData:function (data) { |
| 70 | + data.forEach(function(row){ |
| 71 | + row.sex=row.sex==1?'男':'女' |
| 72 | + }) |
| 73 | + } |
| 74 | + } |
22 | 75 | } |
23 | 76 | }, |
| 77 | + beforeCreate:function(){ |
| 78 | + console.log('====父组件:beforeCreate=====') |
| 79 | + }, |
| 80 | + created:function(){ |
| 81 | + console.log('====父组件:created=====') |
| 82 | + }, |
| 83 | + beforeMount:function(){ |
| 84 | + console.log('====父组件:beforeMount=====') |
| 85 | + }, |
| 86 | + beforeUpdate:function(){ |
| 87 | + console.log('====父组件: beforeUpdate=====') |
| 88 | + }, |
| 89 | +
|
| 90 | +
|
| 91 | + methods:{ |
| 92 | + test:function () { |
| 93 | + console.log("methods-test") |
| 94 | + } |
| 95 | + }, |
24 | 96 | mounted:function () { |
| 97 | + console.log('====父组件:mounted=====') |
| 98 | +
|
| 99 | +
|
| 100 | +
|
25 | 101 | let breadcrumb=[ |
26 | 102 | { |
27 | 103 | link: '/index', |
|
0 commit comments