您好,登錄后才能下訂單哦!
小編給大家分享一下Html5如何嵌入釘釘,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
1,需要在項(xiàng)目種引入釘釘官方的js
<script type="text/javascript" src="http://g.alicdn.com/dingding/dingtalk-jsapi/2.3.0/dingtalk.open.js" > </script>
或者npm 也可以的
2,釘釘自帶的api,有寫(xiě)是需要鑒權(quán)的,所以在使用之前一定要先鑒權(quán)
獲取釘釘接口的鑒權(quán)
dd.config({ agentId:agentid, // 必填,微應(yīng)用ID corpId:corpId,//必填,企業(yè)ID timeStamp:timeStamp, // 必填,生成簽名的時(shí)間戳 nonceStr: nonceStr, // 必填,生成簽名的隨機(jī)串 signature:signature, // 必填,簽名 type:0, jsApiList : [ 'runtime.info', 'biz.contact.choose','biz.contact.chooseMobileContacts', 'device.notification.confirm', 'device.notification.alert', 'device.notification.prompt', 'biz.ding.post','biz.util.previewImage', 'biz.util.openLink','device.geolocation.start','device.geolocation.get','biz.util.uploadImageFromCamera','biz.util.uploadImage' , 'device.audio.startRecord','device.audio.stopRecord','device.audio.play','device.audio.pause','device.audio.download','device.audio.translateVoice','device.audio.onPlayEnd' ] // 必填,需要使用的jsapi列表,注意:不要帶dd。 });
3,鑒權(quán)以后就可以在項(xiàng)目中使用釘釘?shù)腶pi了,但是在調(diào)用釘釘?shù)腶pi的時(shí)候一定要在 dd.ready里面執(zhí)行,不然會(huì)報(bào)錯(cuò)
dd.ready(()=>{ //獲取地理位置 dd.device.geolocation.get({ targetAccuracy : Number, coordinate : Number, withReGeocode : Boolean, useCache:true, //默認(rèn)是true,如果需要頻繁獲取地理位置,請(qǐng)?jiān)O(shè)置false onSuccess : (result) =>{ alert('succe: ' + JSON.stringify(result)) }, onFail : (err) => { alert('fail: ' + JSON.stringify(err)) } }) })
ps:如果是全局使用釘釘?shù)腶pi,可以在app.vue頁(yè)面種調(diào)用,也可以在main.js種調(diào)用
看完了這篇文章,相信你對(duì)“Html5如何嵌入釘釘”有了一定的了解,如果想了解更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。