| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { YTAvoid, yTRouter } from "basic"
- import { DiaLogPageEnum, DiaLogParam, YTDiaLogModel } from "basic/src/main/ets/models/YTDiaLogModel"
- import { BabyFoodApi } from "../Apis/BabyFoodApi"
- import { Recipe } from "../model/Index"
- import { routerUtils } from "../utils/RouterUtils"
- @ObservedV2
- export class SecondViewModel{
- safeTop: number = 0
- // 选择的年龄段
- @Trace monthRange: string = ''
- // 搜索关键字
- @Trace keyword: string = ''
- @Trace recipe: Recipe[] = []
- constructor() {
- this.safeTop = AppStorage.get(YTAvoid.SAFE_TOP_KEY) as number
- this.getRecipeList()
- }
- // 去搜索页
- goToSearchPage(){
- routerUtils.router2RecipeSearchPage()
- }
- // 获取食谱列表
- async getRecipeList(){
- this.recipe = await BabyFoodApi.getAllRecipes(this.keyword, this.monthRange)
- }
- /**
- * 重写的返回逻辑
- * @returns
- */
- _onBackPressed(){
- yTRouter.pop('')
- return true;
- }
- }
|