简体   繁体   English

导航到新团队页面

[英]Navigate to new Teams page

New to Teams (and Blazer) dev and are stumped by a seemingly simple question using the Teams Toolkit. Teams(和 Blazer)开发新手,使用 Teams Toolkit 时被一个看似简单的问题难住了。

We have two Razer pages (ie. under the "Pages" folder in the project - as any asp.net core app has) and want to click from one page to the next from within our Teams Tab App (ideally using an tag) but happy for the navigation code to be executed from the @code block.我们有两个 Razer 页面(即在项目的“Pages”文件夹下 - 正如任何 asp.net 核心应用程序所具有的那样)并且想要从我们的 Teams 选项卡应用程序中的一页点击到下一页(最好使用标签)但很高兴要从@code 块中执行的导航代码。

I've read pretty much everything I can find on this, but like all fairly new tech, the documentation (to me) is confusing at this early stage eg.我已经阅读了几乎所有我能找到的关于这方面的内容,但是就像所有相当新的技术一样,文档(对我来说)在这个早期阶段令人困惑,例如。 do we need the teams-js library in addition to the Teams Toolkit to use deep links, or can we just redirect by getting the URL info from the context (which we can't get also).除了 Teams Toolkit 之外,我们是否需要 teams-js 库来使用深层链接,或者我们是否可以通过从上下文中获取 URL 信息(我们也无法获取)来重定向。

We have tried (by way of an example):我们已经尝试过(举例来说):

@inject NavigationManager nav

and then in the @code block:然后在 @code 块中:

nav.NavigateTo({nav.BaseUri}/TermsOfUse);

but that just returns:但这只会返回:

"Sorry, there's nothing at this address." “抱歉,这个地址什么都没有。”

Lots of confusion at the moment so just some pointers would help please.目前有很多困惑,所以请提供一些建议。

Thanks.谢谢。

I've not worked with Blazer, but I can't imagine it's much different than the Javascript world for this - Teams Toolkit basically scaffolds you up with the teams js library anyway, so don't worry about that.我没有使用过 Blazer,但我无法想象它与 Javascript 的世界有多大不同 - Teams Toolkit 基本上为您搭建了团队 js 库,所以不用担心。 Separately though, if you're navigating within your own app, I think you won't need to worry about deep linking, it should just work the same as if the user visited the page in the browser.不过,如果您在自己的应用程序中导航,我认为您无需担心深度链接,它的工作方式与用户在浏览器中访问页面时的效果一样。 They won't have browser back and forward though, as there's no browser frame, so make sure to provide relevant nav to the user.但是,由于没有浏览器框架,它们不会让浏览器来回移动,因此请确保向用户提供相关的导航。

With regards getting Teams context, you need to make sure you're calling the teams js getContext method - Teams Toolkit should be doing that for you in the sample page it would provide, I'd think, but if not you need to call it yourself, with a relevant callback.关于获取 Teams 上下文,您需要确保调用 teams js getContext方法 - Teams Toolkit 应该在它提供的示例页面中为您执行此操作,我想,但如果不是,您需要调用它你自己,有一个相关的回调。

Teams Tab App is not a very confusing concept, it is very simple. Teams Tab App 不是一个很容易混淆的概念,它很简单。 Give Teams a link, Teams show it as a tab.为 Teams 提供链接,Teams 将其显示为选项卡。 So, regard the project as a simple web app with frontend.因此,将该项目视为带有前端的简单 web 应用程序。 If the nav works well in browser, it can also work in Teams.如果导航在浏览器中运行良好,它也可以在 Teams 中运行。 Do not need to concern about the js library and the context.不需要关心js库和上下文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM