nw-app-read
v2.9.15
Published
## 浏览器H5尝试打开云阅读APP
Downloads
176
Keywords
Readme
nw-app-read
浏览器H5尝试打开云阅读APP
尝试唤起APP,如果未安装APP则跳转下载或wap页面
使用
直接引用
下载dist/openapp.js,通过script标签直接引入打包好的文件
<script src="./dist/openapp.js"></script>
<script type="text/javascript">
NWAppRead.openAppRead({
path: 'detail',
query: {
id: '1b7140a1bb4e4ec3bcbb08e5e0093cee_4' //阅读bookId
},
h5Fallback: true
})
//指定下载地址
NWAppRead.openAppRead({
path: 'detail',
query: {
id: '1b7140a1bb4e4ec3bcbb08e5e0093cee_4' //阅读bookId
},
downloadUrl: 'http://yuedu.163.com/goto?type=181129001'
})
</script>
npm包引入
npm: 通过npm引入然后直接调用openAppRead()完成跳转
import {openAppRead} from 'nw-app-read'
参数为Object类型 如:
| 参数属性 | 类型 | 描述 |
| --- | --- | --- |
| path
| String
| h5跳转应用内页面
|
| query
| Object
| h5跳转应用内页面参数
|
| h5Fallback
| Boolean
| 非必须参数,为true时如果跳转不成功打开h5对应页面,而非跳下载(安卓系统和ios9以下的微信内,不跳微信提示页,直接跳h5页面),默认为false(打不开则跳下载)
|
| replace
| Boolean
| 是否使用location.replace去跳转页面,默认为false
|
| downloadUrl
| String
| 配置客户端下载地址,默认值为https://yuedu.163.com/download
|
尝试APP打开发现页
openAppRead({
path: 'webview'
})
尝试APP打开阅读详情页,打不开跳下载
openAppRead({
path: 'detail',//path='detail'表示使用APP打开详情页面
query: {
id: '1b7140a1bb4e4ec3bcbb08e5e0093cee_4'//阅读bookId
}
})
尝试APP打开资讯详情页,打不开跳下载
openAppRead({
path: 'news',
query: {
id: '0c74e2cb723d4a54a6953ab3317421bb_1', //资讯源id
cid: 'cb3460f480f54daead3495a4354e147d_1' //资讯文章id
}
})
尝试APP打开书架
openAppRead({
path: 'shelf'
})
尝试APP打开包月详情页,IOS客户端不支持shema跳包月详情页,故跳h5页面
openAppRead({
path: 'baoyue',
query: {
id: '60071003'//阅读bookId
}
})
尝试APP打开充值页
openAppRead({
path: 'recharge',
query: {
aid: '', //活动id,可选
money: 2000, //要充值的阅点数,可选
url: 'https://m.yuedu.163.com/' //要打开的h5页面url,可选
}
})
尝试APP打开购买页
openAppRead({
path: 'trade',
query: {
id: '5ff9990cb61e418c82ea3d74f83137a8_4', //阅读bookId
title: '碧台空歌', //书籍title
full: 0, //0 按章购买 1 全本购买
url: 'https://m.yuedu.163.com/' //要打开的h5页面url
}
})
尝试APP打开打包购
openAppRead({
path: 'packagebuy',
query: {
pid: '2260043022', //打包购pid
url: 'https://m.yuedu.163.com/' //要打开的h5页面url
}
})
尝试APP打开h5页面,如活动页等
openAppRead({
path: 'activity',
query: {
url: location.href
}
})
尝试APP打开听书详情页
openAppRead({
path: 'audio',
query: {
id: 'audio_05f871a2e4f04293b9ac1abf95edb912_4' //阅读bookId
}
})
尝试APP打开书架页(V6.0版本)
openAppRead({
path: 'bookshelf'
})
尝试APP打开手机号绑定页(V6.0版本)
openAppRead({
path: 'mobileBind'
})
尝试APP打开排行页(V610版本)
openAppRead({
path: 'rank',
query: {
url: '/store/merged/rankNavi.json?uuid=b5648dd3c4f24d9796f590cd81ca076e&rankType=112',
title: '排行榜'
}
})
尝试APP打开书城(V610版本)
openAppRead({
path: 'bookstore',
query: {
tab_index: 1
}
})
尝试APP打开分类(V610版本)
openAppRead({
path: 'category',
query: {
tab_index: 1,
sub_tab_index: 2
}
})
尝试APP打开包月详情页面(V610版本)
openAppRead({
path: 'package',
query: {
baoyue_id: '60077001' //包月id
}
})
h5Fallback=true
时尝试APP打开页面,打不开跳h5页面
openAppRead({
path: 'detail',
query: {
id: '1b7140a1bb4e4ec3bcbb08e5e0093cee_4'//阅读bookId
},
h5Fallback: true
})