index.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. "use strict";
  2. var _component = require("../common/component");
  3. var _utils = require("../common/utils");
  4. var _my = require("../../__antmove/api/index.js")(my);
  5. var wx = _my;
  6. (0, _component.VantComponent)({
  7. classes: ["title-class"],
  8. props: {
  9. title: String,
  10. fixed: {
  11. type: Boolean,
  12. observer: "setHeight"
  13. },
  14. placeholder: {
  15. type: Boolean,
  16. observer: "setHeight"
  17. },
  18. leftText: String,
  19. rightText: String,
  20. customStyle: String,
  21. leftArrow: Boolean,
  22. border: {
  23. type: Boolean,
  24. value: true
  25. },
  26. zIndex: {
  27. type: Number,
  28. value: 1
  29. },
  30. safeAreaInsetTop: {
  31. type: Boolean,
  32. value: true
  33. }
  34. },
  35. data: {
  36. height: 46
  37. },
  38. created: function created() {
  39. var _getSystemInfoSync = (0, _utils.getSystemInfoSync)(),
  40. statusBarHeight = _getSystemInfoSync.statusBarHeight;
  41. this.setData({
  42. statusBarHeight: statusBarHeight,
  43. height: 46 + statusBarHeight
  44. });
  45. },
  46. mounted: function mounted() {
  47. this.setHeight();
  48. },
  49. methods: {
  50. onClickLeft: function onClickLeft() {
  51. this.$emit("click-left");
  52. },
  53. onClickRight: function onClickRight() {
  54. this.$emit("click-right");
  55. },
  56. setHeight: function setHeight() {
  57. var _this = this;
  58. if (!this.data.fixed || !this.data.placeholder) {
  59. return;
  60. }
  61. wx.nextTick(function () {
  62. _utils.getRect.call(_this, ".van-nav-bar").then(function (res) {
  63. _this.setData({
  64. height: res.height
  65. });
  66. });
  67. });
  68. }
  69. }
  70. });