inner-tabs.js 997 B

123456789101112131415161718192021222324252627282930313233343536
  1. Vue.component('inner-tabs', {
  2. template: '<ul class="nav nav-tabs service-nav-tabs">\
  3. <li v-for="(tab,index) in tabs" role="presentation" :class="{active: (activeidx == index)}">\
  4. <a @click="load(tab, index)">{{tab.title}}</a>\
  5. </li>\
  6. </nav>\
  7. <div class="inner-main" style="height: calc(100% - 40px);overflow:hidden;">\
  8. <iframe :src="url" width="100%" height="100%" frameborder="0" seamless style="display: inline"></iframe>\
  9. </div>\
  10. </div>',
  11. props: ["tabs","activeidx"],
  12. data: function() {
  13. return {
  14. url: ""
  15. }
  16. },
  17. methods: {
  18. load: function(tab, index) {
  19. // top.GlobalEventBus.$emit("active-inner-tabs."+this.namespce, tab)
  20. this.url = tab.href
  21. this.activeidx = index
  22. },
  23. activeTab: function(index) {
  24. // this.activeidx = index
  25. // this.url = this.tabs[this.activeidx].href
  26. // this.load(this.tabs[index], index)
  27. }
  28. },
  29. mounted: function() {
  30. },
  31. watch: {
  32. activeidx: function(idx) {
  33. this.url = this.tabs[idx].href
  34. }
  35. }
  36. })