1/* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import { StartTestTitleComponent } from '../common/ui/StartTestTitleComponent'; 17import { questionList, QuestionItem } from '../common/entity/LocalConfigEntity'; 18 19@Entry 20@Component 21struct Question { 22 build() { 23 Column() { 24 StartTestTitleComponent({ title: "常见问题" }) 25 QuestionComponent() 26 } 27 } 28} 29 30 31@Component 32struct QuestionComponent { 33 @State questionList: Array<QuestionItem> = questionList 34 35 build() { 36 Column() { 37 List() { 38 ForEach(this.questionList, (questionItem) => { 39 ListItem() { 40 Flex({ 41 direction: FlexDirection.Column, 42 alignItems: ItemAlign.Start, 43 justifyContent: FlexAlign.SpaceBetween 44 }) { 45 Text(questionItem.question) 46 .fontSize(18) 47 .fontColor('#333333') 48 .margin({ top: 10, left: 15, right: 15, bottom: 5 }) 49 Text(questionItem.answer) 50 .fontSize(15).fontColor('#666666') 51 .margin({ left: 18, right: 18, bottom: 10 }) 52 }.width('100%') 53 // .borderWidth(1).borderRadius(5) 54 .margin({ bottom: 2, top: 2 }) 55 .shadow({ radius: 10, color: Color.Gray, offsetX: 10, offsetY: 5 }) 56 } 57 }, QuestionItem => QuestionItem.question) 58 }.edgeEffect(EdgeEffect.None) // 滑动到边缘无效果 59 .chainAnimation(false) // 联动特效关闭 60 }.width('95%').height('88%') 61 } 62}