Skip to content
本页导航

添加页面

taro 3.4及以前的添加后需要重新运行程序生效

ts
// src/app.config.ts

export default {
  pages: [
    'pages/home/index',              //在此添加路由
    ...
  ],
  window: {
    backgroundTextStyle: 'light',
    navigationBarBackgroundColor: '#fff',
    navigationBarTitleText: 'WeChat',
    navigationBarTextStyle: 'black'
  }
}
// src/app.config.ts

export default {
  pages: [
    'pages/home/index',              //在此添加路由
    ...
  ],
  window: {
    backgroundTextStyle: 'light',
    navigationBarBackgroundColor: '#fff',
    navigationBarTitleText: 'WeChat',
    navigationBarTextStyle: 'black'
  }
}

需要注意,所有页面都需要用x-navbar嵌套,如下

vue
// src/pages/home/index.vue
<x-navbar
  title="首页"
  home
>
  <view class="home ...">
    ...
  </view>
</x-navbar>
// src/pages/home/index.vue
<x-navbar
  title="首页"
  home
>
  <view class="home ...">
    ...
  </view>
</x-navbar>

接口交互

调用接口前,先从cix/business下寻找,如果没有需要通过 @cixjs/cli 脚手架生成对应文档。需注意,涉及跨服务的调用需要联系技术负责确认后调用。

ts
/** 接口请求方法 */
import ResearchSelectBusiness from "@/cix/business/researchReport/ResearchSelectBusiness";

/** 获取数据 */
async function getFeed() {
  ...
  const res = await ResearchSelectBusiness.searchReportFeed({
    page: 1,
    pageSize: 10,
    ...
  })
  ...
}
/** 接口请求方法 */
import ResearchSelectBusiness from "@/cix/business/researchReport/ResearchSelectBusiness";

/** 获取数据 */
async function getFeed() {
  ...
  const res = await ResearchSelectBusiness.searchReportFeed({
    page: 1,
    pageSize: 10,
    ...
  })
  ...
}

lhiro