标签: bootstrap-vue

Vue 警告 $listeners 和 $attrs 是只读的

我收到很多 Vue 警告,说 $listeners 是只读的,或者 $attrs 是只读的,并且与不同的 Bootstrap 项目或 .

例如:

[Vue warn]: $attrs is readonly.

found in

---> <BDropdown>
       <Display>
         <App>
           <Root>
Run Code Online (Sandbox Code Playgroud)

我非常确定它与以某种方式加载 Vue 实例两次有关,但我真的不知道如何以其他方式执行此操作,以便路由仍然有效。

在我的main.js中,代码如下:

import Vue from 'vue'
import App from './App'
import router from './router'
import firebase from 'firebase';
import './components/firebaseInit';
import store from './store';
import { i18n } from './plugins/i18n.js'
import BootstrapVue from 'bootstrap-vue'
import VueCarousel from 'vue-carousel';

import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

Vue.use(BootstrapVue);
Vue.use(VueCarousel);

let app;
firebase.auth().onAuthStateChanged(user => {
  if(!app) {
    app = new Vue({ …
Run Code Online (Sandbox Code Playgroud)

vue.js vue-router vuejs2 bootstrap-vue

4
推荐指数
1
解决办法
1万
查看次数

带模板的 V 型

我正在使用 vue-bootstrap。我尝试创建动态的网格组件来获取标题和数据。由于我们不知道有多少列传递给组件,因此我们应该检查传递的每个项目。

<template>
    <b-table striped hover :items="items"></b-table>
        <div v-for="title in items">
          <template slot="title.key" slot-scope="data">
            <input v-if="title.isActive" type="text" v-model="data.value">
            <textarea v-else type="text" v-model="data.value"></textarea>
          </template>
        </div>
   </b-table>
</template>

<script>
const items =[
      {'label': 'Description', 'key': 'description'},
      {'label': 'Name',  'key': 'name', 'isActive': true},
    ]
Run Code Online (Sandbox Code Playgroud)

因此,如果 isActive 为 true,则此模板应该是 textarea(列应使用 textarea 而不是 input 进行更改)但是它不起作用,并且没有列更改 inputbox 和 textarea 并保持默认模板

您能帮忙解答一下这些问题吗?

谢谢

vue.js vue-component vuejs2 bootstrap-vue

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

Bootstrap Vue 分页不显示第 2 页的数据

我使用 VueJS、Bootstrap Vue Table 和 Pagination 来显示分页的用户列表。数据似乎已正确加载,但分页的第 2 页未显示任何数据。

我有一个 Users 组件,它为 C 表引导组件传递必要的数据,如下所示:

用户.vue

<c-table
                :tableData="tableData"
                :fields="fields"
/>
<script>
import cTable from '../base/Table.vue'
import UserAPI from '../../api/user.js'
export default {
    created () {
        var vueComponent = this
        UserAPI.getUsers()
        .then(response => {
            if (response.data.success) {
                vueComponent.tableData = response.data.data
            } 
        })
    }
}
</script>
Run Code Online (Sandbox Code Playgroud)

在表组件中,我尝试使用用户组件提供的数据来渲染分页表。

表.vue

<b-table
        :items="tableData.data"
        :fields="fields"
        :current-page="tableData.current_page"
        :per-page="tableData.per_page"
>
</b-table>

<nav>
   <b-pagination
     v-model="tableData.current_page"
     :total-rows="tableData.total"
     :per-page="tableData.per_page"
     prev-text="Prev"
     next-text="Next"
     hide-goto-end-buttons
    />
</nav>

<script>
export default {
    name : 'cTable',
    props: …
Run Code Online (Sandbox Code Playgroud)

pagination vue.js bootstrap-4 vuejs2 bootstrap-vue

4
推荐指数
1
解决办法
6052
查看次数

如何将 BootstrapVue 中的 props 传递给 router-link

以下是 BootstrapVue 导航栏的使用方式https://bootstrap-vue.js.org/docs/components/navbar,但对于一个视图,我需要从导航栏向其传递一个 prop。

将其添加到原始 Vue 中非常容易,但 BootstrapVue 似乎没有解决方案。有人有任何线索吗?

这是一份工作副本,

<b-nav-item to="/login">register</b-nav-item>
Run Code Online (Sandbox Code Playgroud)

我想把它改成这样:

<b-nav-item to="/login" :action="'register'">register</b-nav-item>
Run Code Online (Sandbox Code Playgroud)

其中“action”是我需要传递的支柱。

navbar vue.js bootstrap-vue

4
推荐指数
1
解决办法
3159
查看次数

使用模态 Bootstrap-vue 获取背景上的事件点击

我使用 Vue2 和 Boostrap-vue 来制作模态组件,这是代码

我通过了以下道具@backdrop="handleBackdrop"

<template>
<b-modal
    v-model="showModal"
    id="modal"
    @backdrop="handleBackdrop"
    @ok="handleBackdrop"
  >
...
</template>

<script>
data() {
    return {
      showModal: false
     }
},
  methods: {
    show() {
      this.showModal = true;
    },
    hide() {
      this.showModal = false;
    },
    handleBackdrop(ev) {
      ev.preventDefault();
      console.log("Click backdrop");
    }
}
</script>
Run Code Online (Sandbox Code Playgroud)

我正在使用这个@ok来测试函数handleBackdrop并且它可以工作,但是我无法激活背景上的这个点击

javascript modal-dialog vuejs2 bootstrap-vue

4
推荐指数
1
解决办法
4320
查看次数

在 bootstrap-vue modal (b-modal) int 测试中找不到按钮

我想在我的测试用例中测试模态行为。

  1. 通过页面上的按钮打开模式(isVisible false=> true)
  2. 通过模态上的按钮关闭模态(isVisible trye=> false)

第一步是可以的,但是第二步就失败了。我可以通过ref找到模态,但我找不到模态上的按钮。

首页.vue

<template>
  <div class="home">
    <b-button id='button-open' @click="open">open</b-button>
    <b-modal
      ref="modal-ref"
      hide-footer
    >
      <b-button id='button-close' @click="close">close</b-button>
    </b-modal>
  </div>
</template>


<script>
export default {
  methods: {
    open() {
      console.log('open');
      this.$refs['modal-ref'].show();
    },
    close() {
      console.log('ok');
      this.$refs['modal-ref'].hide();
    },
  },
};
</script>
Run Code Online (Sandbox Code Playgroud)

home.spec.js

<template>
  <div class="home">
    <b-button id='button-open' @click="open">open</b-button>
    <b-modal
      ref="modal-ref"
      hide-footer
    >
      <b-button id='button-close' @click="close">close</b-button>
    </b-modal>
  </div>
</template>


<script>
export default {
  methods: {
    open() {
      console.log('open');
      this.$refs['modal-ref'].show();
    },
    close() {
      console.log('ok');
      this.$refs['modal-ref'].hide();
    },
  },
};
</script> …
Run Code Online (Sandbox Code Playgroud)

bootstrap-modal vue.js bootstrap-4 vue-test-utils bootstrap-vue

4
推荐指数
1
解决办法
1968
查看次数

一旦解除了 boostrap vue 警报,它就不再工作了

我正在尝试使用bootstrap vue alert构建一个全局警报组件。我正在使用store 来保持警戒状态。vuex

下面是我的警报组件Alert.vue

<template>
  <b-alert show :variant="variant" dismissible> {{ message }} </b-alert>
</template>
<script>
export default {
  props: {
    variant: String,
    message: String
  },
  data() {
    return {};
  },
  name: "Alert",

  methods: {},
  computed: {}
};
</script>
<style scoped></style>
Run Code Online (Sandbox Code Playgroud)

下面是我的vuex店铺

const alert = {
  namespaced: true,
  state: {
    variant: "",
    message: "",
    showAlert: false
  },
  getters: {
    variant: state => state.variant,
    message: state => state.message,
    showAlert: state => state.showAlert
  }, …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js bootstrap-4 bootstrap-vue

4
推荐指数
1
解决办法
3381
查看次数

Vuelidate requiredUnless - 仅需填写一项

我有三个输入jobApplyEmail, jobApplyPhonejobApplyOther我正在使用 Vuelidate 对其进行验证。在这三种输入中,用户需要输入至少一种输入。为了实现这一目标,我正在使用它requiredUnless,但由于某种原因它不起作用。

模板重复

    // Using bootstrap-vue
    <b-form-input
      id="jobApplyEmail"
      v-model="form.jobApplyEmail"
      type="email"
      :class="{ 'is-invalid': $v.form.jobApplyEmail.$error }"
      @blur="$v.form.jobApplyEmail.$touch()">
    </b-form-input>
Run Code Online (Sandbox Code Playgroud)

脚本

    import {
      required,
      email,
      requiredUnless
    } from 'vuelidate/lib/validators'
    data() {
        return {
          form: {
            jobApplyEmail: '',
            jobApplyPhone: '',
            jobApplyOther: ''
          },
        }
      },
    computed: {
        isOptional: () => {
          return (
            this.jobApplyEmail !== '' ||
            this.jobApplyOther !== '' ||
            this.jobApplyPhone !== ''
          )
        }
      },
    
    validations: {
        form: {
          jobApplyEmail: { required: requiredUnless('isOptional'), email …
Run Code Online (Sandbox Code Playgroud)

vue.js nuxt.js vuelidate bootstrap-vue

4
推荐指数
1
解决办法
3056
查看次数

bootstrap 5在vue和vite项目上导入错误

这是我在终端上遇到的错误

\n
Deprecation Warning: Passing percentage units to the global abs() function is deprecated.\nIn the future, this will emit a CSS abs() function to be resolved by the browser.        \nTo preserve current behavior: math.abs(100%)\nTo emit a CSS abs() now: abs(#{100%})\nMore info: https://sass-lang.com/d/abs-percent\n\n  \xe2\x95\xb7\n1 \xe2\x94\x82 @import "../../node_modules/bootstrap/scss/bootstrap";\n  \xe2\x94\x82 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  \xe2\x95\xb5\n    resources\\scss\\app.scss 1:1                                divide()\n    node_modules\\bootstrap\\scss\\mixins\\_grid.scss 59:12        row-cols()\n    node_modules\\bootstrap\\scss\\mixins\\_grid.scss 85:13        @content\n    node_modules\\bootstrap\\scss\\mixins\\_breakpoints.scss 68:5  media-breakpoint-up()     \n    node_modules\\bootstrap\\scss\\mixins\\_grid.scss 72:5         make-grid-columns()       \n    node_modules\\bootstrap\\scss\\_grid.scss 38:3                @import\n    node_modules\\bootstrap\\scss\\bootstrap.scss 20:9            @import\n    resources\\scss\\app.scss 1:9                                root stylesheet\n    \n
Run Code Online (Sandbox Code Playgroud)\n

这是我的package.json …

sass vue.js bootstrap-vue vuejs3 bootstrap-5

4
推荐指数
1
解决办法
1938
查看次数

如何在Laravel中包含Bootstrap-Vue

如何将Bootstrap Vue安装/导入/包含在我的laravel项目中?我是Vue的新手,我知道如何安装在Vue JS应用程序中,但如何添加它laravel呢?

app.scss

// Fonts
@import url("https://fonts.googleapis.com/css?family=Nunito");

// Variables
@import "variables";

// Bootstrap
@import "~bootstrap/scss/bootstrap";

@import "node_modules/bootstrap/scss/bootstrap";
@import "node_modules/bootstrap-vue/src/index.scss";

.navbar-laravel {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}
Run Code Online (Sandbox Code Playgroud)

app.js

    /**
     * First we will load all of this project's JavaScript dependencies which
     * includes Vue and other libraries. It is a great starting point when
     * building robust, powerful web applications using Vue and Laravel.
     */

    require("./bootstrap") …
Run Code Online (Sandbox Code Playgroud)

laravel vue.js bootstrap-vue

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