配置多个入口
在项目根目录的 index.js 中,可以注册多个场景页面的入口,方式是在 AppRegistry.registerConfig 中传入数组。每当通过语音打开 opk 时,会根据 domain 和 intent 进入相应的场景页面。默认启动的页面为第一个注册的场景页面,例如下面示例代码中的PageOne。
如果希望实现通过多个意图(domain & intent)打开 opk 的同一个场景页面,需要在intent中传入数组。
AppRegistry.registerConfig([
{
appKey: 'PageOne',
component: () => Page1,
appId: appid,
priority: 3,
intent: 'music&start_music', //可以为domain&intent字符串
},
{
appKey: 'PageTwo',
component: () => Page2,
appId: appid,
priority: 3,
intent: ['weather&get_weather', 'dance&do_dance'], //可以为数组
},
//...
]);