Commit 3329c8e6 authored by Damon's avatar Damon

feat: 科目基本信息组件

parent 5a52bcf8
<template>
<view class="u-flex u-row-around details" @tap.stop="click">
<view>
<u-icon :name="icons" size="50"></u-icon>
</view>
<view class="u-flex details-center">
<view class="name">{{ getName }}</view>
<view class="more" v-if="status === 0">题数:/</view>
<view class="more" v-else>{{ location }} 题数:{{ quantity }} 通过率: {{ pass }}</view>
</view>
<view v-if="status !== 0">
<u-icon name="arrow-right" size="30"></u-icon>
</view>
</view>
</template>
<script>
export default {
name: 'subjectDetails',
props: {
status: {
type: Number,
default: 0,
},
name: {
type: String,
default: '',
},
location: {
type: String,
default: '',
},
quantity: {
type: Number,
default: 0,
},
pass: {
type: String,
default: '',
},
},
data() {
return {}
},
computed: {
icons() {
return this.status === 0 ? 'info-circle' : 'info-circle-fill'
},
getName() {
return this.status === 0 ? '点击选择您将要参加的考试' : this.name
},
},
methods: {
click() {
this.$emit('click')
}
}
}
</script>
<style lang="scss" scoped>
.details {
width: 100%;
background: #fbfbfb;
padding: 20rpx 40rpx;
.details-center {
flex: 1;
flex-flow: column;
padding-left: 40rpx;
.name {
font-size: 32rpx;
color: #101010;
margin-right: auto;
}
.more {
font-size: 24rpx;
color: #797979;
margin-right: auto;
padding-top: 20rpx;
}
}
}
</style>
## 科目基础信息
```
科目基础信息组件,用于首页展示科目基础信息
```
## API
### Props
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :------: | :----: | :----: | :----: | :------------------------------------------------------: |
| status | Number | 0 | 1,2 | 当前状态(1.未选题库 2.已选科目未绑卡 3.已选科目已绑卡) |
| name | String | - | - | 科目名称 |
| location | String | - | - | 题库归属地 |
| quantity | Number | 0 | - | 题数 |
| pass | String | - | - | 通过率 |
### Events
| 事件称名 | 说明 | 返回值 |
| :------: | :--------------: | :----: |
| @click | 点击任意位置触发 | 无 |
## 组件用法
### 基础用法
```html
<subject-base
:status="1"
name="高处安装、维护、拆除作业人员"
location="广东省题"
:quantity="667"
pass="96%"
@click="subjectClick"
></subject-base>
```
```javascript
import subjectBase from '@/components/subject-base/index.vue'
export default {
components: {
subjectBase,
},
data() {
return {}
},
methods: {
subjectClick() {
console.log('1', 1)
},
},
}
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment