vue 安装php,vue中使用openinstall
該樓層疑似違規(guī)已被系統(tǒng)折疊?隱藏此樓查看此樓
1、在html的head中引入外部cdn鏈接
2、
在webpack.base.conf.js中配置
externals: {
OpenInstall: 'OpenInstall'
}
3、
頁(yè)面引入import OpenInstall from 'OpenInstall'
get_openinstall () {
/*
*/
// openinstall初始化時(shí)將與openinstall服務(wù)器交互,應(yīng)盡可能早的調(diào)用
/* web頁(yè)面向app傳遞的json數(shù)據(jù)(json string/js Object),應(yīng)用被拉起或是首次安裝時(shí),通過(guò)相應(yīng)的android/ios api可以獲取此數(shù)據(jù) */
const data = OpenInstall.parseUrlParams()// openinstall.js中提供的工具函數(shù),解析url中的所有查詢參數(shù)
console.log(data)
new OpenInstall({
/* appKey必選參數(shù),openinstall平臺(tái)為每個(gè)應(yīng)用分配的ID */
appKey: '***',
/* openinstall初始化完成的回調(diào)函數(shù),可選 */
onready: function () {
const m = this
const button = document.getElementById('downloadButton')
button.style.visibility = 'visible'
/* 在app已安裝的情況嘗試?yán)餫pp */
m.schemeWakeup()
/* 用戶點(diǎn)擊某個(gè)按鈕時(shí)(假定按鈕id為downloadButton),安裝app */
button.onclick = function () {
m.wakeupOrInstall()
return false
}
}
}, data)
}
4、在methods添加方法 get_openinstall(); 在初始化獲取數(shù)據(jù)后執(zhí)行方法get_openinstall()
總結(jié)
以上是生活随笔為你收集整理的vue 安装php,vue中使用openinstall的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 内存条价格狂飙:需求增加、成本上涨、供应
- 下一篇: php 反射原理,PHP反射机制详解