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