index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <template>
  2. <uni-shadow-root class="weapp-lib-tab-index"><view :class="'custom-class '+(utils.bem('tab__pane', { active, inactive: !active }))" :style="shouldShow ? '' : 'display: none;'">
  3. <slot v-if="shouldRender"></slot>
  4. </view></uni-shadow-root>
  5. </template>
  6. <wxs src="../wxs/utils.wxs" module="utils"></wxs>
  7. <script>
  8. global['__wxRoute'] = 'weapp/lib/tab/index'
  9. "use strict";
  10. Object.defineProperty(exports, "__esModule", { value: true });
  11. var relation_1 = require("../common/relation");
  12. var component_1 = require("../common/component");
  13. (0, component_1.VantComponent)({
  14. relation: (0, relation_1.useParent)('tabs'),
  15. props: {
  16. dot: {
  17. type: Boolean,
  18. observer: 'update',
  19. },
  20. info: {
  21. type: null,
  22. observer: 'update',
  23. },
  24. title: {
  25. type: String,
  26. observer: 'update',
  27. },
  28. disabled: {
  29. type: Boolean,
  30. observer: 'update',
  31. },
  32. titleStyle: {
  33. type: String,
  34. observer: 'update',
  35. },
  36. name: {
  37. type: null,
  38. value: '',
  39. },
  40. },
  41. data: {
  42. active: false,
  43. },
  44. methods: {
  45. getComputedName: function () {
  46. if (this.data.name !== '') {
  47. return this.data.name;
  48. }
  49. return this.index;
  50. },
  51. updateRender: function (active, parent) {
  52. var parentData = parent.data;
  53. this.inited = this.inited || active;
  54. this.setData({
  55. active: active,
  56. shouldRender: this.inited || !parentData.lazyRender,
  57. shouldShow: active || parentData.animated,
  58. });
  59. },
  60. update: function () {
  61. if (this.parent) {
  62. this.parent.updateTabs();
  63. }
  64. },
  65. },
  66. });
  67. export default global['__wxComponents']['weapp/lib/tab/index']
  68. </script>
  69. <style platform="mp-weixin">
  70. @import '../common/index.css';.weapp-lib-tab-index{box-sizing:border-box;flex-shrink:0;width:100%}.van-tab__pane{-webkit-overflow-scrolling:touch;box-sizing:border-box;overflow-y:auto}.van-tab__pane--active{height:auto}.van-tab__pane--inactive{height:0;overflow:visible}
  71. </style>