完成单组练习接口调试
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
const props = defineProps({
|
||||
scores: {
|
||||
type: Array,
|
||||
@@ -15,7 +14,7 @@ const getSum = (a, b, c) => {
|
||||
<view class="container">
|
||||
<view>
|
||||
<text>总成绩</text>
|
||||
<text>23环</text>
|
||||
<text>{{ scores.reduce((last, next) => last + next, 0) }}环</text>
|
||||
</view>
|
||||
<view
|
||||
v-for="(title, index) in ['第一轮', '第二轮', '第三轮']"
|
||||
@@ -24,23 +23,25 @@ const getSum = (a, b, c) => {
|
||||
>
|
||||
<text>{{ title }}</text>
|
||||
<text>{{
|
||||
scores[index * 3 + 0] ? scores[index * 3 + 0] + "环" : "-"
|
||||
scores[index * 4 + 0] ? scores[index * 4 + 0] + "环" : "-"
|
||||
}}</text>
|
||||
<text>{{
|
||||
scores[index * 3 + 1] ? scores[index * 3 + 1] + "环" : "-"
|
||||
scores[index * 4 + 1] ? scores[index * 4 + 1] + "环" : "-"
|
||||
}}</text>
|
||||
<text>{{
|
||||
scores[index * 3 + 2] ? scores[index * 3 + 2] + "环" : "-"
|
||||
scores[index * 4 + 2] ? scores[index * 4 + 2] + "环" : "-"
|
||||
}}</text>
|
||||
<text>{{
|
||||
scores[index * 4 + 3] ? scores[index * 4 + 3] + "环" : "-"
|
||||
}}</text>
|
||||
<text>{{
|
||||
getSum(
|
||||
scores[index * 4 + 0],
|
||||
scores[index * 4 + 1],
|
||||
scores[index * 4 + 2],
|
||||
scores[index * 4 + 3]
|
||||
)
|
||||
}}</text>
|
||||
<text
|
||||
>{{
|
||||
getSum(
|
||||
scores[index * 3 + 0],
|
||||
scores[index * 3 + 1],
|
||||
scores[index * 3 + 2]
|
||||
)
|
||||
}}</text
|
||||
>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user