publishBtn.js 807 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // components/publishBtn/publishBtn.js
  2. Component({
  3. properties: {
  4. data: {
  5. type: Object,
  6. value: {},
  7. },
  8. },
  9. data: {
  10. isRelease: false,
  11. },
  12. lifetimes: {
  13. // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
  14. attached: function () {
  15. this.setData({
  16. isRelease: getApp().globalData.isRelease,
  17. });
  18. },
  19. },
  20. /**
  21. * 组件的方法列表
  22. */
  23. methods: {
  24. tapPulishAction() {
  25. const { data } = this.properties;
  26. const userinfo = wx.getStorageSync("USERINFO");
  27. if (userinfo && userinfo.token) {
  28. wx.navigateTo({
  29. url: `/pages/pulishPost/pulishPost?data=${JSON.stringify(data)}`,
  30. });
  31. } else {
  32. wx.navigateTo({ url: `/pages/login/login` });
  33. }
  34. },
  35. },
  36. });