我是Ionic的新手,我从一个刚离开我工作的女孩那里接过一个项目。我收到一个缺陷,当用户键入“ N / A”以搜索订单时,它将在搜索时破坏URI。一位联合开发人员建议,用“%2F”替换“ /”将在URI中进行修复。
对于长期修复,我希望能够读取用户输入的内容,如果其中包含任何特殊字符,请使用此前缀替换它?
这里有一些代码:async getOrder() {
if ( this.searchValue.length < 1) {
console.log('search is empty');
this.alertService.emptyInput();
} else {
/**
* Setup loading controller
*/
const loading = await this.loadingController.create({
message: 'Searching..'
});
await loading.present();
// Get access token from storage
this.storage.get(ACCESS_TOKEN).then((token) => {
console.log('token from storage: ', token);
if (this.searchValue === 'N/A') {
this.searchValue = 'N%2FA';
}
const urlOrderNo = this.apiUrl + 'ordersearch/' + this.searchValue;
例如,我在IVE中添加了='N / A',但我每次都还需要检查字符串,因为订单号中也可能包含特殊字符。
有人会帮我吗?
我是Ionic的新手,我从一个刚离开我工作的女孩那里接过一个项目。我收到一个缺陷,当用户输入“ N / A”以搜索订单时,当...