URL Forward Configuration

The URL redirect configuration allows you to redirect to an application by invoking an interface on the H5 page.

access

To use this function, you need to embed the following JS in a web page to support HTTP and HTTPS access.

 <script type="text/javascript" src="//statres.quickapp.cn/quickapp/js/routerinline.min.js"></script>
Copy the code

Note: the appRouter and channelReady methods need to be called inside the body tag, not the head tag. (Call directly or import an external JS file call)

Adjust the application

appRouter(packageName, path, params, confirm)

PackageName: specifies the package name of the redirect application. The package name is consistent with the "package" attribute of manifest.json. Path: Indicates the path of the redirect page, which corresponds to the path field of the router page in manifest.json. If path is not transmitted or is an empty string, the home page params is displayed. Params: Configures parameters for transparent transmission to the quick application page. If you do not pass params, the default is to use the parameter value of the page URL from which the appRoute function is currently loaded as the params value. Confirm: Configures the text to be displayed in the confirm window. When the confirm value is converted to Boolean by the framework and the value is false, for example, the confirm value is an empty string, undefined, or null, it indicates that the user does not need to confirm the direct jump. Otherwise, user confirmation is required and confirm text is displayed.Copy the code

Vue Imports quick application SDK

 mounted() {
	 const s = document.createElement('script');
	 s.type = 'text/javascript';
	 s.src = '//statres.quickapp.cn/quickapp/js/routerinline.min.js';
	 document.body.appendChild(s);
	},
Copy the code

The event triggers the Fast Application center redirect

appRouter('com.xx.xx',
        '/target',
       { param1: 12, param2: 34 })
Copy the code

All the code

import headTop from 'src/components/header/head' import alertTip from 'src/components/common/alertTip' export default { Data () {return {system: null, showAlert: false, alertText: null,}}, created() {let u = navigator. UserAgent; let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g let isIOS = !! u.match(/\(i[^;] +; ( U;) ? CPU.+Mac OS X/); If (isAndroid) {this.system = 'Android'; } else if (isIOS) { this.system = 'IOS'; } else { this.system = 'pc'; Alert (' Please use mobile to open this page ') console.info(" Please use mobile to log in ")}}, Mixins: [], Components: {headTop, alertTip,}, props: [], mounted() { const s = document.createElement('script'); s.type = 'text/javascript'; s.src = '//statres.quickapp.cn/quickapp/js/routerinline.min.js'; document.body.appendChild(s); console.info("===========mounted===============") }, methods: If (this.system == 'ios ') {this.showalert = true; } else {try {appRouter('com.xxx.xxx', '/Reader', {params1: XXX, params2: XXX})} the catch (e) {the console. The info (e) alert (' jump failure ')}}}}} < / script >Copy the code