小编Iss*_*aki的帖子

如何将内容与Vuetify中v卡组件的中心对齐?

当前在products.vue中,我有一个productList数组,其中包含4个对象。我将遍历数组,并将每个单独的对象传递给ProductsItem.vue组件。在该组件中,我使用vuetify创建卡。

我无法将内容对准卡的中心。

这是我的代码,我的卡片的屏幕截图以及所需的结果

产品.vue

    <template>
      <div>
        <h1>Products</h1>
        <v-container class="my-5">
          <v-layout row wrap>
            <v-flex xs12 sm6 md4 v-for="productItem in productList" 
    :key="productItem.id">
              <ProductItems :productItem="productItem"/>
            </v-flex>
          </v-layout>
        </v-container>
      </div>
    </template>

    <script>
    import ProductItems from "@/components/ProductItems";


    export default {
      data() {
        return {
          productList: [
            {
              id: 1,
              name: "Superdry",
              description: "Rookie Aviator Patched Bomber"
            },
            {
              id: 2,
              name: "SuperHot",
              description: "Rookie Aviator Patched Bomber"
            },
            {
              id: 3,
              name: "Buron MensWear",
              description: "Skinny Fit Oxford Shirt In White"
            },
            { …
Run Code Online (Sandbox Code Playgroud)

vue.js vuetify.js

7
推荐指数
1
解决办法
8206
查看次数

如何在 vuelidate 中正确向数组添加自定义验证

我有一个具有以下结构的对象数组

varientSections: [
    {
      type: "",
      values: [
        {
          varientId: 0,
          individualValue: ""
        }
      ]
    }
  ]
Run Code Online (Sandbox Code Playgroud)

我创建了一个名为 isDuplicate 的自定义验证,它检查属性“type”的重复值。例如

varientSections: [
    {
      type: "Basket",
      values: [
        {
          varientId: 0,
          individualValue: ""
        }
      ]
    },
    {
      type: "Basket", // ERROR: Duplicate with the "above" object
      values: [
        {
          varientId: 1,
          individualValue: ""
        }
      ]
    }
  ],
Run Code Online (Sandbox Code Playgroud)

我能够让我的自定义验证工作。但是,对于数组中存在的所有对象,$invalid 属性将为 false。因此,数组中的所有对象都将以红色突出显示

在此输入图像描述

下面是我的验证代码:

validations: {
varientSections: {
  $each: {
    type: {
      required,
      isDuplicate(type, varient) {
        console.log(varient);
        const varientIndex = this.varientSections.findIndex(
          v => v.type …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vuelidate

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

How to get the combination of array values from nested arrays in an array of objects

I have an array of objects with the following structure:

 var varientSections = [
  {
    type: "frame",
    values: ["black", "white", "wood"]
  },
  {
    type: "finish",
    values: ["matte", "glossy"]
  }
];
Run Code Online (Sandbox Code Playgroud)

I want to get the combination of the array values and create a new list with it. Right now, I am able to retrieve the combination from the nested array values using the method called getCombination(varientSections). However, I do not know how to create a new list with the …

javascript arrays math combinations vue.js

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

Bootstrap Vue 轮播高度不适合全屏

我正在使用 Bootstrap Vue 创建我的轮播。轮播包含 3 张图像,允许用户循环浏览。我能够显示适合我的笔记本电脑屏幕尺寸的高度和宽度的图像。然而,当我慢慢地将屏幕尺寸缩小到移动设备时,高度不再是屏幕的高度。下面是我的代码和截图

更新:我仍然无法解决这个问题,有人可以帮我吗?

<template>
  <div>
    <b-carousel
      id="carousel-1"
      v-model="slide"
      :interval="4000"
      controls
      indicators
      background="#ababab"
      style="text-shadow: 1px 1px 2px #333;"
      @sliding-start="onSlideStart"
      @sliding-end="onSlideEnd"
    >
      <!-- Text slides with image -->
      <b-carousel-slide
        caption="First slide"
        text="Nulla vitae elit libero, a pharetra augue mollis interdum."
        img-src="https://source.unsplash.com/LAaSoL0LrYs/1920x1080"
      ></b-carousel-slide>

      <!-- Slides with custom text -->
      <b-carousel-slide img-src="https://source.unsplash.com/bF2vsubyHcQ/1920x1080">
        <h1>Hello world!</h1>
      </b-carousel-slide>

      <!-- Slides with image only -->
      <b-carousel-slide img-src="https://source.unsplash.com/szFUQoyvrxM/1920x1080"></b-carousel-slide>
    </b-carousel>

    <p class="mt-4">
      Slide #: {{ slide }}
      <br>
      Sliding: {{ sliding }}
    </p>
  </div>
</template>

<script> …
Run Code Online (Sandbox Code Playgroud)

html carousel vue.js bootstrap-4 bootstrap-vue

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