小编aji*_*mar的帖子

Vue 路由器在重新加载时重定向到主页

我有一个 vue 应用程序,有很多路线。每当我尝试重新加载页面时,它总是将我重定向到主页,而不是刷新当前页面。

以下是我的路由器设置:

export default new Router({
mode: 'history',
base: process.env.BASE_URL,
routes: [
 {
   path: '/',
   name: 'home',
   component: Home,
   children: [
   {
      path: "/dashboard",
      name: 'dashboard',
      component: DashboardView
   },
   {
      path: "/About",
      name:'about',
      component: About
   },
   { 
      path: "/comments",
      name:'comments',
      component: Comments
   },
  ]
}
Run Code Online (Sandbox Code Playgroud)

如何刷新当前页面而不是重定向到主页。

vue.js vue-router vuex

5
推荐指数
1
解决办法
5235
查看次数

Vuetify Tree-view --- 获取父节点和子节点

当我尝试在叶模式下的 Vuetify 树视图中选择一个节点时,我只得到 v-model 中的叶节点。有没有办法让我得到所有的子节点和选定的父节点。

Vuetify 版本:2.2.18

代码链接:https : //codepen.io/pen/?&editable=true&editors=101

选择后的结果:

在此处输入图片说明

实际结果:

Child #1
Child #2
Grandchild #1
Grandchild #2
Run Code Online (Sandbox Code Playgroud)

预期结果:

Root
Child #1
Child #2
Child #3
Grandchild #1
Grandchild #2
Run Code Online (Sandbox Code Playgroud)

vue.js vuetify.js

3
推荐指数
2
解决办法
2667
查看次数

在 vuetify 中更改网格中的列宽

我在行下有三列,每列的 cols 值为 4。我想减少“col1”的宽度,我试图将 cols 值从 4 更改为 3,但该列变得比我预期的要小。所以我想要一个介于 3 到 4 之间的 cols 值(考虑 cols 值为 3.5)。有没有办法我可以做到这一点?

<div id="app">
  <v-app id="inspire">
    <v-container class="grey lighten-5">
      <v-row no-gutters>
        <v-col cols="4">
          <v-card>col1</v-card>
        </v-col>
        <v-col cols="4">
          <v-card>col2</v-card>
        </v-col>
        <v-col cols="4">
          <v-card>col3</v-card>
        </v-col>
      </v-row>
    </v-container>
  </v-app>
</div>
Run Code Online (Sandbox Code Playgroud)

vue.js vuetify.js

3
推荐指数
1
解决办法
5074
查看次数

如何在 v-select 组件 vuetify 上设置过滤条件?

我想知道我是否可以在 v-select 中设置一个条件,以便它只显示必要的选项。下面是一个例子。

<div id="app">
  <v-app id="inspire">
    <v-container fluid grid-list-xl>
      <v-layout wrap align-center>
        <v-flex xs12 sm6 d-flex>
          <v-select
            :items="items"
            label="Select an option"
            item-text ="name"
            item-value = "name"
          ></v-select>
        </v-flex>
      </v-layout>
    </v-container>
  </v-app>
</div>


new Vue({
  el: '#app',
  data: () => ({
    items: [
      {
        name : 'abc', type : 'test'
      },
      {
        name : 'xyz', type : 'dev'
      },
      {
        name : 'lmn', type : 'test'
      }
    ]
  })
})

Run Code Online (Sandbox Code Playgroud)

在这里,我只需要显示类型为“测试”的选项。

vue.js vuetify.js

2
推荐指数
1
解决办法
5228
查看次数

vue 中的多个 vuex 存储

我正在尝试在我的应用程序中实现微前端架构。我有一个公共商店,里面有所有服务中常用的所有数据。在其中一项服务中,我尝试导入公共商店并在全球范围内使用它,但我无法访问它。

例子:

在 main.js 中我正在尝试以下代码:

import Vue from "vue";
// Trying to import the common store
import commonStore from "../../common/src/store"
import router from "./router";
import store from "./store/store";

new Vue({
      router,
      store,
      commonStore
});
Run Code Online (Sandbox Code Playgroud)

在 App.vue 中,我尝试执行以下操作,但无法访问它。

mounted(){
  console.log(this.$commonStore);
}
Run Code Online (Sandbox Code Playgroud)

有什么办法,我可以在 vue.js 中使用多个商店吗?

vue.js vuex vuex-modules

2
推荐指数
1
解决办法
6759
查看次数

标签 统计

vue.js ×5

vuetify.js ×3

vuex ×2

vue-router ×1

vuex-modules ×1