Or npm is also available
Recommended tutorial: “HTML”
2, the api that comes with DingTalk requires authentication, so you must authenticate before using it
Obtain the authentication of the DingTalk interface
dd.config({ agentId:agentid, // required, micro-app ID corpId: corpId, //required, enterprise ID timeStamp:timeStamp, // Required, the timestamp of the generated signature nonceStr: nonceStr, // Required, generate a random string for the signature signature:signature, // required, 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' ] // Mandatory, the jsapi list to be used, note: do not include dd. });
3, after authentication, DingTalk API can be used in the project, but when calling DingTalk API, it must be executed in dd.ready, otherwise an error will be reported
dd.ready(()=>{ // get location dd.device.geolocation.get({ targetAccuracy : Number, coordinate : Number, withReGeocode : Boolean, useCache:true, //The default is true, if you need to get the location frequently, please set false onSuccess : (result) => { alert('succe: ' + JSON.stringify(result)) }, onFail : (err) => { alert('fail: ' + JSON.stringify(err)) } }) })
PS: If you use the API of DingTalk globally, you can call it in the app.vue page or in main.js
Related tutorial: “CSS Tutorial”
The above is the detailed content of the HTML5 embedded DingTalk tutorial, please pay attention to other related articles on 1024programmer.com for more!