jump.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. Page({
  2. onShareAppMessage() {
  3. return {
  4. title: '跳转',
  5. path: 'packageAPI/pages/api/jump/jump'
  6. }
  7. },
  8. data: {
  9. theme: 'light',
  10. setting: {}
  11. },
  12. //打开半屏小程序
  13. openhalfscreenminiprogram(){
  14. wx.openEmbeddedMiniProgram({
  15. appId: 'wxfdcee92a299bcaf1', // 腾讯公益
  16. extraData: {
  17. foo: 'bar'
  18. },
  19. // envVersion: 'develop',
  20. success(res) {
  21. // 打开成功
  22. }
  23. })
  24. },
  25. //打开另一个小程序
  26. openanotherminiprogram(){
  27. wx.navigateToMiniProgram({
  28. appId: 'wxfdcee92a299bcaf1', // 腾讯公益
  29. // extraData: {
  30. // foo: 'bar'
  31. // },
  32. // envVersion: 'develop',
  33. success(res) {
  34. // 打开成功
  35. }
  36. })
  37. },
  38. //退出当前小程序
  39. exitminiprogram(){
  40. wx.exitMiniProgram({
  41. success(){
  42. wx.showToast({
  43. title: '退出成功',
  44. icon: 'none',
  45. duration: 2000
  46. })
  47. },
  48. fail(){
  49. wx.showToast({
  50. title: '退出失败',
  51. icon: 'none',
  52. duration: 2000
  53. })
  54. }
  55. })
  56. },
  57. onLoad() {
  58. this.setData({
  59. theme: wx.getSystemInfoSync().theme || 'light'
  60. })
  61. if (wx.onThemeChange) {
  62. wx.onThemeChange(({theme}) => {
  63. this.setData({theme})
  64. })
  65. }
  66. }
  67. })