Skip to content

下载页面/落地页部署websdk

特别提醒

web-sdk文件会不定期更新,为了可以使用最新版本,推荐使用第三种接入方式

websdk地址

https://res.dankex.cn/sdk/dankex.js
https://res.dankex.cn/sdk/dankex.js

如果你的app下载地址/邀请地址是 http://example.com/share.html?u=u1234567 ,请在share.html页面按照下面的3三种方式之

根据你项目的情况可以选择下面3种部署方式:

1. 直接引入

html
 
<!DOCTYPE html>
<html lang="en"> 
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>APP下载</title>
	<script type="text/javascript" src="https://res.dankex.cn/sdk/dankex.js"></script> 
</head>
<body>
	<button  onclick="download()">下载</button> 
</body> 
</html> 
<script> 	
	function download(){
		DankeX.download('your appkey');  //页面完成下载app跳转, 自动区分安卓/IOS
	} 
 </script>
 
<!DOCTYPE html>
<html lang="en"> 
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>APP下载</title>
	<script type="text/javascript" src="https://res.dankex.cn/sdk/dankex.js"></script> 
</head>
<body>
	<button  onclick="download()">下载</button> 
</body> 
</html> 
<script> 	
	function download(){
		DankeX.download('your appkey');  //页面完成下载app跳转, 自动区分安卓/IOS
	} 
 </script>

2. VUE页面导入

下载js文件 https://res.dankex.cn/sdk/dankex.js 到项目中,例如: \common\dankex.js

html

	<template>
		<view>
			<button @click="download">下载APP </button>
		</view>
	</template>
	<script>
		import * as DankeX from '@/common/dankex';
		export default {
			data() {
				return {					
				}
			},
			onLoad() {				
			},
			methods: {
				download(){
					DankeX.download('your appkey'); //页面完成下载app跳转, 自动区分安卓/IOS
				}
			}
		}
	</script>

	<template>
		<view>
			<button @click="download">下载APP </button>
		</view>
	</template>
	<script>
		import * as DankeX from '@/common/dankex';
		export default {
			data() {
				return {					
				}
			},
			onLoad() {				
			},
			methods: {
				download(){
					DankeX.download('your appkey'); //页面完成下载app跳转, 自动区分安卓/IOS
				}
			}
		}
	</script>

3. VUE动态载入 👍推荐

    ...
    mounted() {
        let that = this;
        this.$nextTick(() => {
            const script = document.createElement('script')
            script.src = 'https://res.dankex.cn/sdk/dankex.js' 
            document.body.appendChild(script)
        });
    },
    methods:{
        download(){
            DankeX.download('your appkey'); //页面完成下载app跳转, 自动区分安卓/IOS
        }
    }
    ...
    mounted() {
        let that = this;
        this.$nextTick(() => {
            const script = document.createElement('script')
            script.src = 'https://res.dankex.cn/sdk/dankex.js' 
            document.body.appendChild(script)
        });
    },
    methods:{
        download(){
            DankeX.download('your appkey'); //页面完成下载app跳转, 自动区分安卓/IOS
        }
    }

4.自定义参数

js
/**
 *  appkey: 应用的appkey
 *  custparams: 不传入或为null,则取访问地址?之后的参数; 如果要自定义,请传入字符串eg:"foo=123&path=index-list"; 如果同时存在,custparams会覆盖的参数
 * 				 
 */
DankeX.download(appkey,custparams=null); 
//调用示例 DankeX.download('x1111111','u=2222&from=huawei');
/**
 *  appkey: 应用的appkey
 *  custparams: 不传入或为null,则取访问地址?之后的参数; 如果要自定义,请传入字符串eg:"foo=123&path=index-list"; 如果同时存在,custparams会覆盖的参数
 * 				 
 */
DankeX.download(appkey,custparams=null); 
//调用示例 DankeX.download('x1111111','u=2222&from=huawei');

5.app下载页模板

模板1 https://download.csdn.net/download/boshen2/88700441

模板2 https://blog.csdn.net/boshen2/article/details/135388220