pdf.vue 671 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <view>
  3. <web-view :src="url"></web-view>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. url: '', // pdf链接
  11. }
  12. },
  13. onLoad (options) {
  14. console.log(options);
  15. let links = options.links;
  16. this.url = 'https://www.geidcp.com/' + links;
  17. uni.downloadFile({
  18. url: this.url,
  19. success: function (res) {
  20. var filePath = res.tempFilePath;
  21. uni.openDocument({
  22. filePath: filePath,
  23. success: function (res) {
  24. console.log('打开文档成功');
  25. }
  26. });
  27. }
  28. });
  29. },
  30. methods: {
  31. }
  32. }
  33. </script>
  34. <style>
  35. </style>