标签: bootstrap-vue

如何仅使用 Vue.js 更改背景颜色的样式

import Vue from 'vue'
import App from './App'
import BootstrapVue from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'




Vue.config.productionTip = false
Vue.use(BootstrapVue);


/* eslint-disable no-new */
new Vue({
  el: '#app',
  components: { App },
  template: '<App/>'
})
Run Code Online (Sandbox Code Playgroud)

import Vue from 'vue'
import App from './App'
import BootstrapVue from 'bootstrap-vue'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'




Vue.config.productionTip = false
Vue.use(BootstrapVue);


/* eslint-disable no-new */
new Vue({
  el: '#app',
  components: { App },
  template: '<App/>'
})
Run Code Online (Sandbox Code Playgroud)

我尝试使用该命令使用 vue 绑定样式更改元素的背景颜色, v-bind:style='{backgroundColor : color} 但它不是全高,即使我尝试删除 CSS 上 body …

css vue.js vue-component vuejs2 bootstrap-vue

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

在 vue.js 中格式化输入类型日期

我使用 bootstrap-vue。

它包括输入类型日期。

当我写一些数字时,默认格式是 yyyyyy-mm-dd。

我想将格式 yyyyyy-mm-dd 更改为 yyyy-mm-dd。

vue.js html5-input-date bootstrap-vue

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

如何使用 vue-test-utils 打开 bootstrap-vue 模式?

我使用 bootstrap 作为我的设计框架,并且一直在使用 bootstrap-vue。现在我想实现一些测试来配合我的组件。我正在编写一个非常简单的测试,以确保打开了一个模态。我在 vue-test-utils 中使用什么来打开 bootstrap-vue 模式?

我正在使用 Laravel、bootstrap-vue、vue-test-utils、mocha 和 mocha-webpack 附带的基础知识。

我正在尝试使用wrapper.find('#modal-1').trigger('click'). 我试过使用指令<b-button v-b-modal.modal-1>我试过使用 event <b-button @click="$bvModal.show('modal-1')">。最后,我<button @click="showModal = true">在 b-modal 上尝试了一个带有这个的常规按钮<b-modal v-model="showModal">。我还尝试$nextTick在触发器和断言之间添加一个。

import { createLocalVue, mount } from '@vue/test-utils';
import expect from 'expect';
import BootstrapVue from 'bootstrap-vue';
import MyComponent from '@/components/MyComponent.vue';

const localVue = createLocalVue();

localVue.use(BootstrapVue);

describe ('MyComponent', () => {
    let wrapper;

    beforeEach(() => {
        wrapper = mount(QuotesExceptions, {
            localVue
        });
    });

    it ('opens a …
Run Code Online (Sandbox Code Playgroud)

vue.js vue-test-utils bootstrap-vue

6
推荐指数
1
解决办法
4650
查看次数

如何从 vuex 动作调用 bootstrap-vue 模态和吐司?

有没有人尝试过将 boostrap-vue 与 vuex 结合使用?我很难从 vuex 操作中调用模态和吐司。

显然我不能this从 vuex 商店使用,因此我不能使用:

this.$bvModal.show('modalId');
Run Code Online (Sandbox Code Playgroud)

我也试过像这样调用模态

import Vue from 'vue';

Vue.prototype.$bvModal.show('transaction');
Run Code Online (Sandbox Code Playgroud)

但是控制台给了我以下警告:

BootstrapVue 警告]:必须从 Vue 实例“this”上下文访问“$bvModal”

知道如何直接从 vuex 动作调用模态和吐司吗?

vue.js vuex bootstrap-vue

6
推荐指数
2
解决办法
3586
查看次数

如何在 b-table 的 v-slot:cell() 模板中获取项目值 - BootstrapVue

我是一个非常新的编程。我试图弄清楚如何绑定数据以获取链接 :href 使用 store、vuex 和 bootstrap-vue 表工作。我为此花了 4 天时间,现在我快要死了。请帮忙。

book.js(商店,vuex)

books: [
    {
      id: 1,
      name: "name 1",
      bookTitle: "book1",
      thumbnail: '../../assets/img/book01.jpeg',
      url: "https://www.google.com",
      regDate: '2019-10'
    },
    {
       id: 2,
      name: "name2",
      bookTitle: "book2",
      thumbnail: "book2",
      url: "http://www.yahoo.com",
      regDate: '2019-10'
    },
Run Code Online (Sandbox Code Playgroud)

书单.vue

books: [
    {
      id: 1,
      name: "name 1",
      bookTitle: "book1",
      thumbnail: '../../assets/img/book01.jpeg',
      url: "https://www.google.com",
      regDate: '2019-10'
    },
    {
       id: 2,
      name: "name2",
      bookTitle: "book2",
      thumbnail: "book2",
      url: "http://www.yahoo.com",
      regDate: '2019-10'
    },
Run Code Online (Sandbox Code Playgroud)
<script>
export default {
  name: "BookList",
  components: …
Run Code Online (Sandbox Code Playgroud)

data-binding vue.js bootstrap-vue v-slot

6
推荐指数
1
解决办法
9946
查看次数

如何在 Bootstrap-Vue 中增加工具提示的宽度

有没有办法增加 bootstrap vue 中工具提示的宽度。我有一个重要的声明要显示在工具提示中。并且工具提示将消息显示为连续三个单词。所以工具提示的高度更大,宽度更小。

<div>
  <span id="disabled-wrapper" class="d-inline-block" tabindex="0">
    <b-button variant="primary" style="pointer-events: none;" disabled>Disabled button</b-button>
  </span>
  <b-tooltip target="disabled-wrapper">jasfkjsdfsdafiads uhsdifumasb jhgasd  asd ua d uiuud  iad iadh ad ihhad ad aid ia dia id ai did ai d a ushdufsd ushd iufads fiuash dfias d uusahdfiusahifu ais fisadu fius fsuhdfushfisafh isaf hisauhfisa hhfish fiushf iush fisu hfisuh fis hfius hfius stooltip</b-tooltip>
</div>
Run Code Online (Sandbox Code Playgroud)

css tooltip width vue.js bootstrap-vue

6
推荐指数
1
解决办法
4297
查看次数

如何在 Bootstrap Vue 表中动态添加一列

我正在使用 Bootstrap Vue并希望动态添加一列或仅在数据中满足某些条件时才显示该列。我正在尝试了解作用域插槽以及这是否是我应该使用格式化程序回调函数的方向。理想情况下,只有在数据中可用时,我才想添加列“版本 2”。我不知道从哪里开始。

代码

    <b-table striped responsive hover :items="episodes" :fields="fields" :filter="filter">
           <template v-slot:cell(version_1)="data">
        <a :href="`${data.value.replace(/[^a-z]-/i,'-').toLowerCase()}`">Definition</a>
      </template>

    </b-table>
</template>
<script>
data() {

    return {
      fields: [{
          key: 'category',
          sortable: true
        },
        {
          key: 'episode_name',
          sortable: true
        },
        {
          key: 'episode_acronym',
          sortable: true
        },
        {
          key: 'version_1',
          sortable: true
        }
      ],
      episodes: [],
      versions: [],
    }

  },   
mounted() {
    return Promise.all([
        // fetch the owner of the blog
        client.getEntries({
          content_type: 'entryEpisodeDefinitions',
          select: 'fields.title,fields.category,fields.slug,fields.episodeAcronym,fields.version,sys.id'
        })

      ])
        .then(response => {
        // console.info(response[0].items); …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js bootstrap-vue

6
推荐指数
1
解决办法
4140
查看次数

BootstrapVue 中 Sidebar 禁用滚动并处理 Close 方法

我想问 2 个关于BootstrapVue中的Sidebar 的问题。

  1. 打开侧边栏后禁用滚动
  2. 单击侧边栏(背景)外部时如何处理关闭方法

我正在使用https://bootstrap-vue.org/docs/components/sidebar

在此输入图像描述

<template>
  <div>
    <b-button v-b-toggle.sidebar-backdrop>Toggle sSidebar</b-button>
    <b-sidebar
      id="sidebar-backdrop"
      title="Sidebar with backdrop"
      backdrop
      shadow
    >
      <div class="px-3 py-2">
        <p>
          Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis
          in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
        </p>
        <b-img src="https://picsum.photos/500/500/?image=54" fluid thumbnail></b-img>
      </div>
    </b-sidebar>
  </div>
</template>
Run Code Online (Sandbox Code Playgroud)

谢谢并赞赏。

vue.js nuxt.js bootstrap-vue

6
推荐指数
1
解决办法
5018
查看次数

当在父级中单击按钮时,使所有 &lt;b-collapse&gt; 在 child.vue 中不可见

我正在与BootstrapVue.

我有以下情况:我有 aparent.vue和 a child.vue。在我的parent.vue目录中v-for,我可以创建多个Buttons. 其中每一个都会触发b-collapse我的child.vue,并且每一个都有多个b-collapse。(参见代码)

现在我需要做以下事情:当我的内心被关闭时,我想关闭b-collapse我的所有内心。但我不知道该怎么做..(当我重新打开我的-collapse 时它们也应该关闭)child.vueb-collapseparent.vueparent.vue

我已将代码减少到最少。但只是为了获得额外的信息,我每次都会this.inputs.push[{id: this.id +=1}]添加新的项目或元素。所以他们每个人都有一个unique id.

希望有人可以帮助我!

代码

父级.vue

<div v-for="item in inputs" :key="item.id">
  <b-button v-b-toggle="'NewItem'+item.id"></b-button>
</div>

<Child/>

<b-button @click="addNewItem()"></b-button>
Run Code Online (Sandbox Code Playgroud)

孩子.vue

<b-collapse visible :id="'NewItem' + item.id">  //Here i need a solution
  <div v-for="element in inputs" :key="element.id">
    <b-button v-b-toggle="'Element' + element.id"></b-button>
    <b-collapse :id="'Element' + element.id>
      <div>Here is Element …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuejs2 bootstrap-vue

6
推荐指数
1
解决办法
732
查看次数

“node_modules/vue/dist/vue.runtime.esm-bundler.js”中没有与导入“default”匹配的导出

我尝试启动一个全新的 Vue 项目,并想向其中添加 Bootstrap。

\n

一切都很好,但是当我尝试启动它时,出现以下错误:

\n

node_modules/bootstrap-vue/esm/vue.js:13:7: ERROR: No matching export in node_modules/vue/dist/vue.runtime.esm-bundler.js" for import "default"

\n

我从npm init vue@latest\n开始,之后我做了一个npm install。\n要安装我制作的bootstrap npm install bootstrap bootstrap-vue。\n如果此时我进行了npm run,一切都很好,但是当我尝试在我的项目中导入bootstrap时,我收到错误。这是我的使用方法:

\n
import { createApp } from 'vue'\nimport { createPinia } from 'pinia'\nimport { BootstrapVue } from 'bootstrap-vue'\n\nimport App from './App.vue'\nimport router from './router'\n\nimport './assets/main.css'\n\nconst app = createApp(App)\n\nVue.use(BootstrapVue)\n\napp.use(createPinia())\napp.use(router)\n\napp.mount('#app')\n
Run Code Online (Sandbox Code Playgroud)\n

这是错误的踪迹:

\n
 npm run dev\n\n> test@0.0.0 dev C:\\Users\\ycolin\\projet\\test\n> vite\n\n\n  VITE v4.0.4  ready in 2204 ms\n\n  \xe2\x9e\x9c  Local:   http://127.0.0.1:5173/\n  \xe2\x9e\x9c  Network: …
Run Code Online (Sandbox Code Playgroud)

bootstrap-4 bootstrap-vue vuejs3 vite

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