ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

ionic3 刷新页面之后,回退按钮消失

2022-07-28 00:00:11  阅读:184  来源: 互联网

标签:历史记录 detail ionic3 defaultHistory 回退 history page 页面


参考 How can i reload the current page in Ionic 3 when i refresh the browser? 的回复,


我的代码:

@IonicPage(
  {
    defaultHistory: ['MainPage'] //设置上个页面的名称,defaultHistory 是在这个页面没有历史记录的情况下(比如直接刷新当前页面)设置一个默认的历史记录,告知页面,是从哪个页面跳转到当前页面的一个历史记录,会显示一个返回到指定页面的 返回按钮
  }
)
@Component({
  selector: 'page-test',
  templateUrl: 'test.html',
})
export class TestPage {}

文档 IonicPage 中 提到 Default History ,默认的历史记录

The default history of any page can be set in the defaultHistory property. This history will only be used if the history doesn't already exist, meaning if you navigate to the page the history will be the pages that were navigated from.
The defaultHistory property takes an array of strings. For example, setting the history of the detail page to the list page where the name is list:

一些页面的默认的历史记录记录在 defaultHistory 属性中。这个属性只使用在历史记录不存在的情况下,管理你的这个页面是从哪个页面跳过来的历史记录。

这个 defaultHistory 属性是一个字符串数组。比如: 设置从页面名为 list 页面跳转到详情页面的历史记录。

@IonicPage({
  name: 'detail-page', //页面名
  segment: 'detail/:id',
  defaultHistory: ['list']
})

In this example, if the app is launched at http://localhost:8101/#/detail/my-detail the displayed page will be the 'detail-page' with an id of my-detail and it will show a back button that goes back to the 'list' page.
An example of an application with a set history stack is the Instagram application. Opening a link to an image on Instagram will show the details for that image with a back button to the user's profile page. There is no "right" way of setting the history for a page, it is up to the application.

在这个例子,如果应用是在 http://localhost:8101/#/detail/my-detail 发起页面访问,这个详情页面的页面名为 'detail-page'和将会显示一个 跳回到 list(页面名)页面 的返回按钮。

另外一个例子是Instagram应用 设置历史记录存储栈.在Instagram 应用中打开一个图片链接,将会显示这个图片详情和一个返回按钮回到用户个人资料页面。这个没有“可能”的方式设置这个页面的历史记录,这个属性就可以给应用处理这个问题.

标签:历史记录,detail,ionic3,defaultHistory,回退,history,page,页面
来源: https://www.cnblogs.com/fsong/p/16527029.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有