欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Element-UI 使用el-row 分欄布局的教程

 更新時間:2020年10月26日 16:35:11   作者:清雨未盡時  
這篇文章主要介紹了Element-UI 使用el-row 分欄布局的教程,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

使用多個卡片顯示的時候,并且要求當(dāng)列數(shù)到一定數(shù)目的時候,要自動換行,el-container 布局就滿足了需求了,就要用到el-row 布局做分欄處理,

代碼如下

<template>
 <el-row :gutter="20" class="el-row" type="flex" >
 <el-col :span="8" v-for = "(item,index) in apps" :key="item.id" class="el-col" >
  <el-card class="el-card" :key="index" onclick="">
  <div slot="header" class="clearfix">
   <span>{{item.appname}}</span>
  </div>
  <div >
   <div class="text item">
   <div class="item_tag" >
    <span >用戶標(biāo)簽:</span>
   </div>
   <div class="item_desr">
    <span > {{item.tag}}</span>
   </div>
   </div>
   <div class="text item">
   <div class="item_tag">
    <span>搜索標(biāo)簽:</span>
   </div>
   <div class="item_desr">
    {{item.seatag}}
   </div>
   </div>
   <div class="text item">
   <div class="item_tag">
    <span>短信簽名:</span>
   </div>
   <div class="item_desr">
    <span>
     {{item.wxname}}
    </span>
   </div>
   </div>
   <div class="text item">
   <div class="item_tag">
    <span>客服QQ:</span>
   </div>
   <div class="item_desr">
    {{item.qq}}
   </div>
   </div>
   <div class="text item">
   <div class="item_tag">
    <span>商務(wù)合作:</span>
   </div>
   <div class="item_desr">
    {{item.buscoo}}
   </div>
   </div>
  </div>
  </el-card>
 </el-col>
 <el-col :span="8">
  <el-card class="box-card" style="min-height: 200px;" align="middle" onclick="">
  <div class="el-card__body mid">
   <el-button icon="el-icon-circle-plus" circle></el-button>
   <el-button style="margin-left: 0;color: #505458" type="text">添加APP</el-button>
  </div>
  </el-card>
 </el-col>
 </el-row>
</template>
<script>

css

<style type="text/css">
 .all{
 margin-top: -30px;
 word-break: break-all;
 height: 100%;
 }
 .mid{
 margin-top: 25%;
 height: 50%;
 }
 .mid_item{
 justify-content: center;
 align-items: center;
 }
 .item {
 margin-bottom: 10px;
 }
 .item_tag{
 float:left;
 text-align:left;
 }
 .item_desr{
 margin-left: 40%;
 min-height: 30px;
 text-align:left;
 }
 .text {
 width: 100%;
 font-size: 12px;
 font-family: "Microsoft YaHei";
 color: #909399;
 }
 .clearfix:before,
 .clearfix:after {
 display: table;
 content: "";
 }
 .clearfix:after {
 clear: both
 }
 
 .el-card {
 min-width: 100%;
 height: 100%;
 margin-right: 20px;
 /*transition: all .5s;*/
 }
 .el-card:hover{
 margin-top: -5px;
 }
 .el-row {
 margin-bottom: 20px;
 display: flex;
 flex-wrap: wrap
 }
 .el-col {
 border-radius: 4px;
 align-items: stretch;
 margin-bottom: 40px;
 }
</style>

補充知識:vue element框架中el-row控件里按列排列失效問題的解決

最近我在使用vue的ui框架element-ui,可能是自己經(jīng)驗不足,遇到了很奇怪的問題,在這里特意把解決的步驟記錄一下,希望能對大家有所幫助。

首先我使用的分欄間隔的布局方式,參照官網(wǎng)上的例子:

<el-row :gutter="20">
<el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
<el-col :span="6"><div class="grid-content bg-purple"></div></el-col>
</el-row>
<style>
 .el-row {
 margin-bottom: 20px;
 &:last-child {
  margin-bottom: 0;
 }
 }
 .el-col {
 border-radius: 4px;
 }
 .bg-purple-dark {
 background: #99a9bf;
 }
 .bg-purple {
 background: #d3dce6;
 }
 .bg-purple-light {
 background: #e5e9f2;
 }
 .grid-content {
 border-radius: 4px;
 min-height: 36px;
 }
 .row-bg {
 padding: 10px 0;
 background-color: #f9fafc;
 }
</style>

應(yīng)該效果如下圖:

但是我在參考例子后,代碼如下:

App.vue

<template>
 <div id="app">
<el-row :gutter="20">
 <el-col :span="6"><div class="grid-content bg-purple">1</div></el-col>
 <el-col :span="6"><div class="grid-content bg-purple">1</div></el-col>
 <el-col :span="6"><div class="grid-content bg-purple">1</div></el-col>
 <el-col :span="6"><div class="grid-content bg-purple">1</div></el-col>
</el-row>
</div>
</template>
<style>
 .el-row {
 margin-bottom: 20px;
 }
 .el-col {
 border-radius: 14px;
 }
 .bg-purple {
 background: #d3dce6;
 }
 .grid-content {
 border-radius: 14px;
 min-height: 36px;
 }
</style>

main.js

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'//A Vue.js 2.0 UI Toolkit for Web
Vue.use(ElementUI);

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
 el: '#app',
 router,
 components: { App },
 template: '<App/>'
})

可是效果如下:

奇怪了,為何布局變成了縱向,明明row中的布局應(yīng)該是按列排列的。經(jīng)過排查發(fā)現(xiàn)自己少了這一行:import ‘element-theme-chalk';

也就是代碼應(yīng)該如下:

main.js

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'//A Vue.js 2.0 UI Toolkit for Web
import 'element-theme-chalk';
Vue.use(ElementUI);

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
 el: '#app',
 router,
 components: { App },
 template: '<App/>'
})

這個時候效果如下,應(yīng)該是我們希望看到的,至少列生效了:

我看了一下文檔,發(fā)現(xiàn)并沒有特別指出這一行的配置,可能是我遺漏了或者其他的原因?qū)е碌模灿锌赡苁枪倬W(wǎng)沒有標(biāo)識出這一點??傊由狭诉@一行配置解決了我的問題。在這里做一個筆記,也希望能夠幫助到遇到類似的問題的同學(xué)。

以上這篇Element-UI 使用el-row 分欄布局的教程就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • vue watch關(guān)于對象內(nèi)的屬性監(jiān)聽

    vue watch關(guān)于對象內(nèi)的屬性監(jiān)聽

    這篇文章主要介紹了vue watch關(guān)于對象內(nèi)的屬性監(jiān)聽的相關(guān)知識,非常不錯,具有一定的參考借鑒價值 ,需要的朋友可以參考下
    2019-04-04
  • 深入理解vue-router之keep-alive

    深入理解vue-router之keep-alive

    本篇文章主要介紹了深入理解vue-router之keep-alive。keep-alive使被包含的組件保留狀態(tài),或避免重新渲染,有興趣的可以了解一下
    2017-08-08
  • vue項目中用cdn優(yōu)化的方法

    vue項目中用cdn優(yōu)化的方法

    本篇文章主要介紹了vue項目中用cdn優(yōu)化的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-01-01
  • Vue自定義指令的使用詳細介紹

    Vue自定義指令的使用詳細介紹

    我們看到的v-開頭的行內(nèi)屬性,都是指令,不同的指令可以完成或?qū)崿F(xiàn)不同的功能,對普通 DOM元素進行底層操作,這時候就會用到自定義指令。除了核心功能默認內(nèi)置的指令 (v-model 和 v-show),Vue 也允許注冊自定義指令
    2022-09-09
  • vue中配置后端接口服務(wù)信息詳解

    vue中配置后端接口服務(wù)信息詳解

    這篇文章主要介紹了vue中配置后端接口服務(wù)信息詳解,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-03-03
  • vue 設(shè)置proxyTable參數(shù)進行代理跨域

    vue 設(shè)置proxyTable參數(shù)進行代理跨域

    這篇文章主要介紹了vue 設(shè)置proxyTable參數(shù)進行代理跨域的相關(guān)資料,及代理跨域的概念原理,需要的朋友可以參考下
    2018-04-04
  • Vue關(guān)于組件化開發(fā)知識點詳解

    Vue關(guān)于組件化開發(fā)知識點詳解

    在本篇文章里,小編給大家分享的是關(guān)于Vue關(guān)于組件化開發(fā)知識點詳解內(nèi)容,有興趣的朋友們可以學(xué)習(xí)下。
    2020-05-05
  • 關(guān)于element-ui中el-form自定義驗證(調(diào)用后端接口)

    關(guān)于element-ui中el-form自定義驗證(調(diào)用后端接口)

    這篇文章主要介紹了關(guān)于element-ui中el-form自定義驗證(調(diào)用后端接口),具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-07-07
  • vue封裝第三方插件并發(fā)布到npm的方法

    vue封裝第三方插件并發(fā)布到npm的方法

    本篇文章主要介紹了vue封裝第三方插件并發(fā)布到npm的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-09-09
  • vue動態(tài)生成新表單并且添加驗證校驗規(guī)則方式

    vue動態(tài)生成新表單并且添加驗證校驗規(guī)則方式

    這篇文章主要介紹了vue動態(tài)生成新表單并且添加驗證校驗規(guī)則方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-10-10

最新評論