inner-tabs.js 897 B

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