a链接跳转事项

很多都是已经知道的,但是老忘,记一下笔记
我的是angular2项目,代码偏angular2书写方式

1、普通跳转

百度

在这里插入图片描述

1.1、将图像作为链接


	

1.2、链接到同一个页面的不同位置

查看 Chapter 4。

Chapter 1

This chapter explains ba bla bla

Chapter 2

This chapter explains ba bla bla

Chapter 3

This chapter explains ba bla bla

Chapter 4

This chapter explains ba bla bla

Chapter 5

This chapter explains ba bla bla

Chapter 6

This chapter explains ba bla bla

Chapter 7

This chapter explains ba bla bla

1.3、在新的浏览器窗口打开链接

Visit 百度

a链接跳转事项_第1张图片

2、携带参数跳转

2.1、普通跳转



		

2.2、变量跳转


// a 是变量, 页面传递的
// 这种的跳转没有限制
  
  跳转
  


//  有token验证时,我使用的这个 用路由的方式跳转
详情
// 或
 
 		跳转
 

2.3、已经有接口的跳转

html页面

 
 ……
	 
	      

{{item.fileName}}

……

ts页面:

 public href: any = '';

async clickFile(profileId, fileType) {
    this.href = 'https://api461.bzhyun.cn/Chat/GetUploadedSingleObject?fileId=' + profileId + '&contentType=' + fileType + '&tenantId=11';
  }

接收操作

这些是即将要跳转的页面,还有跳转到的页面的参数处理,比较麻烦,先写一个我的处理吧:

const url1 = window.location.search;
    if (  url1 !== '') {
      this.url = url1.slice(8);
      const { result: res }: any = await this.detection.getSource3ById(this.url);
      this.total = res.totalCount;
      this.listOfData = res.items;
    } else {
      await this.getTable(this.MaxResultCount, this.SkipCount);
    }

自己写的不咋滴,但别人写的好,推荐一下别人的:
https://blog.csdn.net/weixin_44285250/article/details/88567947
https://www.runoob.com/jsref/prop-loc-href.html
https://blog.csdn.net/sumjob/article/details/103399104

你可能感兴趣的:(a链接跳转事项)