Mapping a request to another request, interface is still online, static file online server mapping to the local development server, suitable for only debugging their own code, compared to recommended (e.g. : When testing H5 wechat payment, it is not possible to test it locally. We need to send the package online or build a sandbox environment. At this time, we can map the static resources requested online to the local)
1. Right-click a directory or file of a static resource and choose Remote Mapping from the shortcut menu.
2. Enter the address “mapped to”, for example, my local project ishttp://192.168.2.144:8080/
3. Click OK to complete. At this time, the interface requests online data, but static resources are local.
Second, to map a request to a local file, suitable for packaging for the appearance of the js bugs, because frequent packaging is not very convenient, so can the local package after replace the online resources (such as code compressed in different operating systems or on equipment appeared difference, relative to the above a method more troublesome, because need local has been packaged, So if the bug is not caused by packaging, use the one above.)
1. Right-click a directory or file of a static resource and choose Local Mapping from the shortcut menu.
2. Replace online files or directories with local files or directories, and click OK.
3. Before and after comparison of effects, no version is issued, but resources can be replaced. In this way, if there are bugs in packaged JS, we can pack it frequently locally, then replace it, and send the stable package online again
4. Note: If the certificate of the website is not trusted or the data requested by the page through the interface is abnormal, for example, a picture is obtained through the interface, but the rendering of this picture on the page is not correct, then the certificate is not installed or the certificate is incorrect. Please install the certificate as follows:
1. Open thechls.pro/sslDownload the certificate
2. Chrome Google Browser installation (PC)
2.1 the import
2.2 Step One
2.3 Select Trusted Root Certification Authorities
3. Install Chrome Google browser (mobile terminal), do not use QQ browser, it will directly hijack the certificate or download failure, strongly recommend Google browser mobile terminal download
3.1 Still open the above website to download the certificate, click OK, this is very simple
Rewrite (you can edit any parameter in the request). I’ll give you an example of debugging production code: adding vConsole to production without affecting the code on the line
1. Click the menu bar “Tools” -> “Rewrite”
2. Add a rule (Add rule -> Enter rule name -> Add address to replace -> Add overridden rule (replace place))
Here I insert one side of the code in front of the head tag to generate Vconsole
<script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.3.4/vconsole.min.js"></script>
<script>
new VConsole()
</script>
Copy the code