index.js 759 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. const plugin = requirePlugin('hello-plugin')
  2. Page({
  3. data: {
  4. items: [],
  5. currentItem: 0
  6. },
  7. onLoad() {
  8. const world = plugin.answer
  9. },
  10. onShow() {
  11. plugin.getOcrResult({
  12. success: (res) => {
  13. console.log(res)
  14. wx.showLoading({
  15. title: '0980890890',
  16. })
  17. },
  18. failed: (error) => {
  19. console.log(error)
  20. }
  21. })
  22. },
  23. goPluginPage(){
  24. wx.navigateTo({
  25. url: 'plugin://hello-plugin/bank-card?token=123',
  26. events: {
  27. someEvent: (data) => {
  28. console.log(data)
  29. }
  30. }
  31. })
  32. },
  33. addItem() {
  34. this.data.items.push(this.data.currentItem++)
  35. this.setData({
  36. items: this.data.items,
  37. currentItem: this.data.currentItem
  38. })
  39. }
  40. })