MapboxNav.nvue 994 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <view>
  3. <view class="contentInRowC" style="margin-top: 80rpx;">
  4. <text>Navigation</text>
  5. <image style="height: 60rpx;width: 60rpx;" src="/static/imags/loading2.gif" mode="scaleToFill"></image>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. const mapBoxNavigation = uni.requireNativePlugin("Insdoor-mapBoxPlugin");
  11. export default {
  12. data() {
  13. return {
  14. navdata:''
  15. }
  16. },
  17. onLoad(option) {
  18. this.navdata=JSON.parse(option.navdata);
  19. },
  20. mounted() {
  21. console.log('2-------------------');
  22. this.startNav();
  23. },
  24. methods: {
  25. kaishidao(){
  26. this.startNav();
  27. },
  28. startNav(){
  29. mapBoxNavigation.navigationToDestination(
  30. {//108.390558,22.818876
  31. "latitude":JSON.stringify(this.navdata.latitude),
  32. "longitude":JSON.stringify(this.navdata.longitude),
  33. "destination": this.navdata.address
  34. },
  35. (ret) => {
  36. if(ret.typeName=='closenVC'){
  37. uni.navigateBack();
  38. }
  39. }
  40. );
  41. },
  42. }
  43. }
  44. </script>
  45. <style>
  46. </style>