set-navigation-bar-title.js 722 B

1234567891011121314151617181920212223242526272829303132333435
  1. Page({
  2. onShareAppMessage() {
  3. return {
  4. title: '设置页面标题',
  5. path: 'packageAPI/pages/page/set-navigation-bar-title/set-navigation-bar-title'
  6. }
  7. },
  8. setNaivgationBarTitle(e) {
  9. const title = e.detail.value.title
  10. console.log(title)
  11. wx.setNavigationBarTitle({
  12. title,
  13. success() {
  14. console.log('setNavigationBarTitle success')
  15. },
  16. fail(err) {
  17. console.log('setNavigationBarTitle fail, err is', err)
  18. }
  19. })
  20. return false
  21. },
  22. onLoad() {
  23. this.setData({
  24. theme: wx.getSystemInfoSync().theme || 'light'
  25. })
  26. if (wx.onThemeChange) {
  27. wx.onThemeChange(({theme}) => {
  28. this.setData({theme})
  29. })
  30. }
  31. }
  32. })