Giter Club home page Giter Club logo

Comments (17)

bhuh12 avatar bhuh12 commented on May 23, 2024

$routerTab
漏了 r

from vue-router-tab.

chenyuhu avatar chenyuhu commented on May 23, 2024

WX20200222-185639@2x.png
WX20200222-185907@2x.png

不好意思,标题上打错了,实际上没有少

from vue-router-tab.

bhuh12 avatar bhuh12 commented on May 23, 2024

RouterTab 组件在 created 钩子时会注入到 Vue 原型,因此,你只能在这之后访问 this.$routerTab

from vue-router-tab.

chenyuhu avatar chenyuhu commented on May 23, 2024

貌似还是不行

from vue-router-tab.

bhuh12 avatar bhuh12 commented on May 23, 2024

你是在什么场景下需要访问 RouterTab 呢?如果 RouterTab 都没创建组件,肯定是无法访问的,即使访问也没意义啊

from vue-router-tab.

chenyuhu avatar chenyuhu commented on May 23, 2024

点击事件的时候触发,需要用到this.$routerTab.open()

from vue-router-tab.

chenyuhu avatar chenyuhu commented on May 23, 2024

vue-cli 2.x 的项目不可以使用的吗?

from vue-router-tab.

bhuh12 avatar bhuh12 commented on May 23, 2024

可以用啊,页签组件展示正常吗?
你贴一下事件相关页面组件代码

from vue-router-tab.

chenyuhu avatar chenyuhu commented on May 23, 2024

页签组件展示正常

入口文件

....
import RouterTab from 'vue-router-tab'
Vue.use(RouterTab)
.....

路由文件

import Vue from 'vue'
import Router from 'vue-router'
import { RouterTabRoutes } from 'vue-router-tab'
Vue.use(Router)
export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      name: '主页',
      component: () => import('../../components/workWin/Home/Home'),
      meta: {
        title: '主页'
      }
    },
    {
      path: '/childMod',
      name: '子功能模块',
      component: () => import('../../components/workWin/Home/SubModuleFun')
    },
    {
      path: '/work',
      name: '工作模块',
      meta: {
        title: '工作模块'
      },
      component: () => import('../../components/workWin/workHome'),
      children: [
        ...RouterTabRoutes,
        ...dailyWork
      ]
    }
  ]
})

使用文件

<!--  -->
<template>
  <div>
    <router-tab></router-tab>
  </div>
</template>

<script>
export default {
  data() {
    return {}
  },
  props: {},
  methods: {},
  created() {},
  components: {},
  watch: {},
  computed: {},
  mounted() {
    console.log(this.$routerTab)
  }
}
</script>

<style scoped lang="scss"></style>

from vue-router-tab.

bhuh12 avatar bhuh12 commented on May 23, 2024

使用文件 的代码是 ../../components/workWin/workHome 吗?

mounted 里面加 debugger 调试看能否进入

实在不行你将能重现问题的最简代码放 github 我看看

你用 Vue chrome 开发插件输出看看,随便选中一个节点,输出 $vm0.$routerTab
image

from vue-router-tab.

bhuh12 avatar bhuh12 commented on May 23, 2024

而且通常是不建议直接使用 this.$routerTab.open() 打开页签的,这个方法会刷新之前存在的已经打开过的地址

推荐是使用 router-link$router.push

image

from vue-router-tab.

chenyuhu avatar chenyuhu commented on May 23, 2024

WX20200224-142825@2x.png
但是如果我要使用this.$routerTab 的方法还是不能使用的啊

from vue-router-tab.

bhuh12 avatar bhuh12 commented on May 23, 2024

将能重现问题的最简代码(剥离不需要的代码)放 github 我看看

from vue-router-tab.

chenyuhu avatar chenyuhu commented on May 23, 2024

hi man
demo 的地址在这儿https://github.com/chenyuhu/electron-tab.git 辛苦试一下吧

from vue-router-tab.

bhuh12 avatar bhuh12 commented on May 23, 2024

新的 1.0.0-alpha.2 版本应该能解决这个问题,你更新下看看

from vue-router-tab.

chenyuhu avatar chenyuhu commented on May 23, 2024

谢谢

from vue-router-tab.

chenyuhu avatar chenyuhu commented on May 23, 2024

非常感谢,问题解决了!

from vue-router-tab.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.