当前位置: 首页 > news >正文

【VUE】Vue3+Element Plus动态间距处理

目录

  • 1. 动态间距调整
    • 1.1 效果演示
    • 1.2 代码演示
  • 2. 固定间距
    • 2.1 效果演示
    • 2.2 代码演示
  • 其他情况


1. 动态间距调整

1.1 效果演示

  • 并行效果
    在这里插入图片描述
  • 并列效果
    在这里插入图片描述

1.2 代码演示

<template><div style="margin-bottom: 15px">direction:<el-radio v-model="direction" value="horizontal">horizontal</el-radio><el-radio v-model="direction" value="vertical">vertical</el-radio></div><div style="margin-bottom: 15px">fillRatio:<el-slider v-model="fillRatio" /></div><el-space fill wrap :fill-ratio="fillRatio" :direction="direction" style="width: 100%">测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" /></el-space></template>
<script setup>
import { ref } from 'vue'const direction = ref('horizontal')
const fillRatio = ref(10)
</script>
<style lang="scss" scoped></style>

2. 固定间距

2.1 效果演示

在这里插入图片描述

2.2 代码演示

其实就是去掉了那个调整标签<el-slider> 等等。

<template> <el-space fill wrap :fill-ratio="fillRatio" :direction="direction" style="width: 100%">测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" /></el-space></template>
<script setup>
import { ref } from 'vue'const direction = ref('horizontal')
const fillRatio = ref(10)		//重点关注这个值:固定参数
</script>
<style lang="scss" scoped></style>

其他情况

有可能因为内容没占满整行而导致,width: 100% 平铺到整行的情况。如下所示:

在这里插入图片描述
解决方案就是:添加<div></div>标签,如:

    <el-space fill wrap :fill-ratio="fillRatio" :direction="direction" style="width: 100%">测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" />测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" /><div>测试输入框间隔距离:<el-input v-model="input" style="width: 240px;margin-right: 100px ;" placeholder="Please input" /></div></el-space>

效果:
在这里插入图片描述
这样就好啦~
需要调整的细节在调整一下就ok~
感谢观看~~!

http://www.lryc.cn/news/335361.html

相关文章:

  • 华为 2024 届校园招聘-硬件通⽤/单板开发——第一套(部分题目分享,完整版带答案,共十套)
  • 自己整理的ICT云计算题库四
  • 5.消息队列
  • 基于强化学习的对抗意图识别
  • vue canvas绘制信令图,动态显示标题、宽度、高度
  • 无影云电脑不能连接到本机的调试串口的解决方案
  • gpt科普1 GPT与搜索引擎的对比
  • Element-plus使用中遇到的问题
  • 如何使用Arduino IDE对STM32F103C8T6进行编程
  • 【迅为iMX6Q】开发板 Linux version 6.6.3 SD卡 启动
  • C语言每日一题(66)三数之和
  • vue3-element-admin实现同一个菜单多标签
  • 第三十六节 Java 网络编程
  • DRF的认证、权限、限流、序列化、反序列化
  • 解决:Cannot read properties of undefined (reading ‘validate‘)问题
  • 关于IP地址发展历程的详细探讨
  • 【LeetCode热题100】【二叉树】将有序数组转换为二叉搜索树
  • 文心一言和GPT-4全面比较
  • Mac的终端配置
  • 制作一个RISC-V的操作系统十-Trap和Exception(流 mtvec mepc mcause mtval mstatus trap完整流程)
  • 【爬虫开发】爬虫从0到1全知识md笔记第4篇:Selenium课程概要,selenium的介绍【附代码文档】
  • 对一个时间序列中的每个元素按照指定精度向上取整
  • 51单片机+TN901非接触式红外测温设计论文与源码PCB等资料
  • AI创业项目:AI旅游规划定制师
  • win 安装 Stable Diffusion
  • STM32F407+FreeRTOS+LWIP UDP组播
  • (源码+部署+讲解)基于Spring Boot + Vue的车位租赁系统设计与实现
  • Lecture 2~4 About Filter
  • 【LINUX】Linux 命令大全:系统管理与网络操作指南
  • Day50 动态规划 part11