Files
Nexior/src/components/document/ApiListItem.vue
T
2023-01-21 00:52:05 +08:00

65 lines
1.2 KiB
Vue

<template>
<div class="item" @click="onClick">
<el-link type="primary" class="link" :underline="false">
<span class="name">{{ api?.title }}</span>
</el-link>
<el-tag v-if="api?.request?.method" type="primary" class="request-method" effect="dark">
{{ api?.request?.method }}
</el-tag>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { IApi } from '@/operators/api/models';
export default defineComponent({
name: 'ApiListItem',
props: {
api: {
type: Object as () => IApi,
required: true
}
},
methods: {
onClick() {
this.$router.push({
name: 'document-detail',
params: {
id: this.api.id
}
});
}
}
});
</script>
<style lang="scss" scoped>
$height: 35px;
.item {
height: $height;
line-height: $height;
padding-left: 5px;
cursor: pointer;
border-radius: 5px;
overflow: hidden;
position: relative;
&:hover {
background-color: rgba(0, 0, 0, 0.1);
}
.link {
color: #333;
.name {
display: flex;
}
}
.request-method {
position: absolute;
right: 10px;
top: 5px;
}
}
</style>