• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 { SettingList } from '@ohos/settingItems'
17
18let storage = LocalStorage.GetShared()
19
20@Entry(storage)
21@Component
22struct Index {
23  @LocalStorageProp('currentBreakpoint') curBp: string = 'sm'
24  @LocalStorageProp('windowWidth') windowWidth: number = 300
25  @LocalStorageProp('isSplitMode') isSplitMode: boolean = false
26  @State itemTitle: string = ''
27
28  aboutToAppear() {
29    this.itemTitle = getContext().resourceManager.getStringSync($r('app.string.settings').id)
30  }
31
32  build() {
33    Navigation() {
34      SettingList()
35    }
36    .title(this.itemTitle)
37    .mode(this.isSplitMode ? NavigationMode.Split : NavigationMode.Stack)
38    .navBarWidth(0.4 * this.windowWidth)
39    .hideToolBar(true)
40    .width('100%')
41    .height('100%')
42    .backgroundColor($r("sys.color.ohos_id_color_sub_background"))
43  }
44}