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 */ 15import router from '@ohos.router' 16import TitleBar from '../common/TitleBar' 17 18@Entry 19@Component 20struct Index { 21 @Builder 22 OperationBtn(text: Resource, handleClick: () => void) { 23 Button({ type: ButtonType.Capsule }) { 24 Text(text) 25 .fontSize(30) 26 .fontColor(Color.White) 27 } 28 .width('90%') 29 .height(70) 30 .backgroundColor('#0D9FFB') 31 .margin(20) 32 .onClick(handleClick) 33 } 34 35 build() { 36 Column() { 37 TitleBar() 38 this.OperationBtn($r('app.string.create_qrcode'), () => { 39 router.push({ 40 url: 'pages/CreateQRCode' 41 }) 42 }) 43 this.OperationBtn($r('app.string.parse_qrcode'), () => { 44 router.push({ 45 url: 'pages/ParseQRCode' 46 }) 47 }) 48 } 49 .height('100%') 50 .width('100%') 51 } 52}