Commit f4c05ea9 authored by Damon's avatar Damon

feat: 科目统计组件

parent 7059c899
......@@ -38,7 +38,7 @@ export default {
}
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.card {
.content {
flex-flow: column;
......
......@@ -53,7 +53,7 @@ export default {
},
}
</script>
<style lang="scss">
<style lang="scss" scoped>
.sheet {
flex-flow: column;
.lists {
......
<template>
<view class="u-flex statis">
<view class="u-flex top">
<view class="u-flex days">
<view>
<u-count-to :start-val="0" :end-val="days"></u-count-to>
</view>
<view>累计坚持天数</view>
</view>
<view class="u-flex topics">
<view class="topics-lists">
今日做题:
<u-count-to :start-val="0" :end-val="today" :font-size="30" color="#000"></u-count-to>
</view>
<view class="topics-lists">
累计做题:
<u-count-to :start-val="0" :end-val="total" :font-size="30" color="#000"></u-count-to>
</view>
</view>
</view>
<view class="center">
<u-button type="primary" @click="answer">每日一练</u-button>
</view>
<view class="bottom">
<u-notice-bar mode="vertical" type="none" :list="dynamic"></u-notice-bar>
</view>
</view>
</template>
<script>
export default {
name: 'subjectStatistics',
props: {
days: {
type: Number,
default: 0,
},
today: {
type: Number,
default: 0,
},
total: {
type: Number,
default: 0,
},
dynamic: {
type: Array,
default: [],
},
},
data() {
return {
lists: [],
}
},
created() {},
methods: {
answer() {
this.$emit('answer')
},
},
}
</script>
<style lang="scss" scoped>
.statis {
flex-flow: column;
width: 100%;
background: #fbfbfb;
padding: 10rpx;
.top {
width: 100%;
justify-content: space-around;
padding-top: 20rpx;
.days {
flex-flow: column;
flex: 1;
border-right: 2rpx solid #ccc;
}
.topics {
flex-flow: column;
flex: 1;
padding-left: 50rpx;
.topics-lists {
width: 100%;
padding: 10rpx 0rpx;
}
}
}
.center {
width: 100%;
padding: 30rpx 30rpx 0 30rpx;
}
.bottom {
width: 100%;
padding: 10rpx;
}
}
</style>
## 科目统计
```
科目统计组件,用于首页统计模块。
```
## API
### Props
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :-----: | :----: | :----: | :----: | :-------------------------: |
| days | Number | 0 | - | 累计坚持天数 |
| today | Number | 0 | - | 今日做题 |
| total | Number | 0 | - | 累计做题 |
| dynamic | Array | [] | [] | 滚动动态列表 **格式见下文** |
### dynamic 格式
```json
["寒雨连江夜入吴", "平明送客楚山孤", "洛阳亲友如相问", "一片冰心在玉壶"]
```
### Events
| 事件称名 | 说明 | 返回值 |
| :------: | :------------------: | :----: |
| @answer | 点击每日一练按钮触发 | 无 |
## 组件用法
### 基础用法
```html
<subject-statistics
:days="40"
:today="97"
:total="668"
:dynamic="list"
@answer="answer"
></subject-statistics>
```
```javascript
import subjectStatistics from '@/components/subject-statistics/index.vue'
export default {
components: {
subjectStatistics,
},
data() {
return {
list: [
'寒雨连江夜入吴',
'平明送客楚山孤',
'洛阳亲友如相问',
'一片冰心在玉壶',
],
}
},
methods: {
answer() {
console.log('每日一练')
},
},
}
```
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