Commit 5a52bcf8 authored by Damon's avatar Damon

feat: 科目状态提示组件

parent f4c05ea9
<template>
<view class="u-flex u-row-around tips">
<view class="title">
{{ title }}
</view>
<view class="validity" v-if="validity && status === 2">
有效期至:{{ validity }}
</view>
</view>
</template>
<script>
const title = ['请选择题库...', '绑卡或购买该题库后,即可开始刷题...', '刷题备考中...']
export default {
name: 'subjectTips',
props: {
status: {
type: Number,
default: 0,
},
validity: {
type: String,
default: '',
}
},
data() {
return {
}
},
computed: {
title() {
return title[this.status]
}
}
}
</script>
<style lang="scss" scoped>
.tips {
width: 100%;
background: #fbfbfb;
padding: 20rpx 40rpx;
font-size: 26rpx;
.title {
flex: 1
}
}
</style>
## 科目状态提示
```
科目状态提示组件,用于首页展示科目状态提示
```
## API
### Props
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :------: | :----: | :----: | :----: | :------------------------------------------------------: |
| status | Number | 0 | 1,2 | 当前状态(0.未选题库 1.已选科目未绑卡 2.已选科目已绑卡) |
| validity | String | - | - | 有效期, 状态等于 2 的时候需传 |
## 组件用法
### 基础用法
```html
<subject-tips :status="2" validity="2012.09.02"></subject-tips>
```
```javascript
import subjectTips from '@/components/subject-tips/index.vue'
export default {
components: {
subjectTips,
},
}
```
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