@@ -75,6 +75,11 @@ class YTRouter extends NavPathStack {
routerBack() {
yTRouter.pop()
}
+
+ // 跳转至精选书单页面
+ router2BookListPage(){
+ this.pushPathByName('BookListPage', null)
+ }
export const yTRouter = YTRouter.getInstance()
@@ -0,0 +1,20 @@
+import { RouterPage } from 'basic';
+import { RootColumnStyle } from '../style/RootColumnStyle';
+import { BookListViewModel } from './viewModel/BookListViewModel';
+// 精选书单
+@ComponentV2
+@RouterPage
+struct BookListPage {
+ @Local vm: BookListViewModel = new BookListViewModel();
+ build() {
+ NavDestination() {
+ Column() {
+ .attributeModifier(new RootColumnStyle())
+ .hideTitleBar(true)
+}
@@ -1,20 +0,0 @@
-@Entry
-@Component
-struct Index {
- @State message: string = 'Hello World';
-
- build() {
- Row() {
- Column() {
- Text(this.message)
- .fontSize($r('app.float.page_text_font_size'))
- .fontWeight(FontWeight.Bold)
- .onClick(() => {
- this.message = 'Welcome';
- })
- }
- .width('100%')
- .height('100%')
-}
-import { RouterPage } from 'basic'
-@RouterPage
-struct TestRouterPage {
- NavDestination(){
- Column(){
- Text('你好路由')
- .hideTitleBar(true)
-@Builder
-function TestRouterBuilder() {
- TestRouterPage()
@@ -0,0 +1,5 @@
+@ObservedV2
+export class BookListViewModel{
@@ -6,10 +6,7 @@ export class RootColumnStyle implements AttributeModifier<ColumnAttribute> {
@Trace safeTop: number = AppStorage.get(YTAvoid.SAFE_TOP_KEY) as number
@Trace safeBottom: number = AppStorage.get(YTAvoid.SAFE_BOTTOM_KEY) as number
- constructor(needSafeBottom: boolean = true) {
- if (!needSafeBottom) {
- this.safeBottom = 0
+ constructor() {
// 组件常态样式
@@ -8,6 +8,5 @@
"phone"
],
"deliveryWithInstall": true,
- "pages": "$profile:main_pages"
@@ -1,5 +0,0 @@
-{
- "src": [
- "pages/Index"
- ]
@@ -1,9 +1,3 @@
{
- "routerMap": [
- {
- "name": "TestRouterPage",
- "pageSourceFile": "src/main/ets/pages/TestRouterPage.ets",
- "buildFunction": "TestRouterBuilder"
+ "routerMap": []