I want to display two tabs in the Monaca Onsen UI.

Asked 1 years ago, Updated 1 years ago, 116 views

Is it possible to display the tab bar in two tiers in the Monaca Onsen UI?

monaca onsen-ui

2022-09-30 20:47

1 Answers

I looked at the implementation, but it seems that there is no process to change the stage in the middle, so
I think it's difficult to display two columns.

It was like this (partial excerpt).

//tabbar item templates
var defaultInnerTemplate=
    '<div ng-if="icon!=undefined" class="tab-bar__icon">'+
      '<ons-icon="{{tabIcon}}}">/ons-icon>'+
    '</div>'+
    '<div ng-if="label" class="tab-bar__label">{{label}}</div>';

// tabbar item added
compile: function(element, attrs) {
  element.addClass('tab-bar__item');

  return function(scope, element, attrs, controller, translate) {
    vartabbarView=element.inheritedData('ons-tabbar');
    if(!tabbarView){
      US>throw new Error ('This is-tab element is must be child of ons-tabbar element.');
    }

    element.addClass(tabbarView._scope.modifierTemplater('tab-bar--*_item'));
    element.addClass(tabbarView._scope.modifierTemplater('tab-bar__item--*'));

    translate(scope.$parent, function(cloned){
      var wrapper = angular.element(element[0].querySelector('.tab-bar-inner'));

      if(attrs.icon||attrs.label||!cloned[0]){
        var innerElement=angular.element('<div>'+defaultInnerTemplate+'</div>').children();
        wrapper.append(innerElement);
        $compile(innerElement)(scope);
      } else{
        wrapper.append(cloned);
      }
    });


2022-09-30 20:47

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.