MyUsers.vue 1.2 KB
Newer Older
1
<template>
2 3 4
	<div>
		<!-- 标题 -->
		<h4 class="text-center">用户管理</h4>
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
		<!-- 用户列表 -->
		<table class="table table-bordered table-striped table-hover">
			<thead>
				<tr>
					<th>序号</th>
					<th>姓名</th>
					<th>年龄</th>
					<th>头衔</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr v-for="item in userlist" :key="item.id">
					<td>{{ item.id }}</td>
					<td>{{ item.name }}</td>
					<td>{{ item.age }}</td>
					<td>{{ item.position }}</td>
					<td>
						<a href="#" @click.prevent="gotoDetail(item.id)">详情</a>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
30 31 32 33
</template>

<script>
export default {
34 35 36 37 38 39 40 41 42 43 44
    name: 'MyUser',
    data() {
        return {
            // 用户列表数据
            userlist: [
                { id: 1, name: '嬴政', age: 18, position: '始皇帝' },
                { id: 2, name: '李斯', age: 35, position: '丞相' },
                { id: 3, name: '吕不韦', age: 50, position: '商人' },
                { id: 4, name: '赵姬', age: 48, position: '王太后' },
            ],
        }
45
    },
46 47 48 49 50 51
    methods: {
        gotoDetail(id) {
            this.$router.push('/home/userinfo/' + id)
        },
    },
}
52 53 54
</script>

<style lang="less" scoped></style>