You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.2 KiB

  1. // components/note/note.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {},
  7. /**
  8. * 组件的初始数据
  9. */
  10. data: {
  11. pages: [1],
  12. path: "",
  13. },
  14. /**
  15. * 组件的方法列表
  16. */
  17. methods: {
  18. onRet: function () {
  19. wx.reLaunch({
  20. url: "/Pages/travel/home/home",
  21. });
  22. },
  23. insertImg: function (name, path) {
  24. let qurey = this.createSelectorQuery();
  25. qurey
  26. .select(name)
  27. .context(function (res) {
  28. (this.editorCtx = res.context),
  29. this.editorCtx.insertImage({
  30. src: path,
  31. width: "100rpx",
  32. height: "100rpx",
  33. });
  34. })
  35. .exec();
  36. },
  37. insertPic: function () {
  38. const name = "#editor" + this.data.pages[this.data.pages.length - 1];
  39. let that = this;
  40. wx.chooseMedia({
  41. count: 10,
  42. camera: "back",
  43. success(res) {
  44. that.insertImg(name, res.tempFiles[0].tempFilePath);
  45. },
  46. });
  47. },
  48. insertPage: function () {
  49. let that = this;
  50. const length = that.data.pages.length;
  51. that.setData({
  52. pages: that.data.pages.concat([length + 1]),
  53. });
  54. },
  55. },
  56. });