<template> <div style="display: flex;line-height: 50px;"> <div style="margin-top: 8px;"> <i class="el-icon-s-fold" style="font-size: 20px;cursor: pointer;" @click="collapse"></i> </div> <div style="flex: 1;text-align: center;font-size: 34px;line-height: 65px"> <span>欢迎来到仓库管理系统</span> </div> <el-dropdown> <i class="el-icon-user" style="font-size:25px ; margin-right: 10px ; line-height: 70px" ></i> <el-dropdown-menu slot="dropdown"> <el-dropdown-item @click.native="toUser">个人中心</el-dropdown-item> <el-dropdown-item @click.native="logOut">退出</el-dropdown-item> </el-dropdown-menu> </el-dropdown> </div> </template>为什么其中<i class="el-icon-user" style="font-size:25px ; margin-right: 10px ; line-height: 70px" ></i>这行代码加入<span>{{ user.name }}</span>无法运行
时间: 2023-08-13 12:36:05 浏览: 181
因为在这个代码段中,使用了<i>标签来显示用户图标,而这个标签是不支持包含其他标签的。如果想要在图标旁边显示用户名,可以在图标和用户名之间加入一个空格,如下所示:
<i class="el-icon-user" style="font-size:25px ; margin-right: 10px ; line-height: 70px"></i>{{ user.name }}</span>
相关问题
<el-col :span="6" :xs="24"> <div class="card-list" style="display: flex;width: 100%;flex-wrap: wrap;justify-content: space-between; align-items: center;"> <!--div style="display: flex; justify-content: space-between; align-items: center;"--> <!--el-card style="margin-bottom:20px; width:300px;height:280px"--> <el-card style="width:300px;height:280px; margin-left:1px;margin-bottom: 10px"> <template #header> <div class="h-4 pl-[90px]" style="width: 100%;display: flex;justify-content: space-between; align-items: center;"> <div class="user-block" style="line-height: 30px;font-size: 20px;"> <span class="username text-muted" style="margin-left: 10px;">故障模拟设备</span> <span class="description" style="margin-left: 10px;">教学理论设备</span> </div> <el-tag class="username text-muted" style="margin-left: 10px;color:green">运行</el-tag> <div class="el-icon-setting" style="font-size: 25px; color: rgba(18, 21, 211, 0.829);" @click="update"></div> </div> </template> <div class="flex justify-center" style="display: flex;width: 100%;flex-wrap: wrap;justify-content: space-between; align-items: center;"> <img class="rightullidiv" :src="'../../../static/images/fan.gif'"> <!--img class="w-[100px] h-[100px] rounded-lg" src="'../../../static/images/fan.gif'" alt=""--> <div class="ml-3" style="width:120px;height:280px; margin-left:1px;margin-bottom: 10px"> <!--el-descriptions class="el-descriptions__body" size="small" :column="Number('1')" border--> <el-descriptions size="small" :column="Number('1')" border> <el-descriptions-item label="电压">380 V</el-descriptions-item> <el-descriptions-item label="电流">10 A</el-descriptions-item> <el-descriptions-item label="通讯">正常 </el-descriptions-item> </el-descriptions> </div> </div> </el-card> </div> </el-col>实现图片与el-descriptions-item label="电压"并排放置,如何修改代码
您可以将图片与el-descriptions-item label="电压"都放在一个div中,设置该div的display属性为flex,并设置justify-content为space-between或者space-around。具体代码如下:
```
<div class="flex justify-between">
<img class="rightullidiv" :src="'../../../static/images/fan.gif'">
<el-descriptions size="small" :column="Number('1')" border>
<el-descriptions-item label="电压">380 V</el-descriptions-item>
</el-descriptions>
</div>
```
您可以将以上代码替换掉原来的el-descriptions代码部分即可。
<script setup> import HelloWorld from './components/HelloWorld.vue' import {ref } from 'vue' import TheWelcome from './components/TheWelcome.vue' let count = ref(0) function numFun(){ console.log(count) count.value++ } let message =ref() let text=ref() let radio= </script> <template> <header> <img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" /> <div class="wrapper"> <HelloWorld msg="第一个vue项目" /> </div> <div> <button @click="numFun"> Count is: {{ count }} </button> </div> <div> <input type="text" v-model="message" placeholder="请输入...."> <p>{{message}}</p> </div> <div> <input type="radio" value="man" v-model="picked" id='man'> <label for='man'>man</label> <input type="radio" v-model="picked" value="woman" id='woman'><br/> <label for='woman'>woman</label> </div> </header> <!-- <main> <TheWelcome /> </main> --> </template> <style scoped> header { line-height: 1.5; } .logo { display: block; margin: 0 auto 2rem; } @media (min-width: 1024px) { header { display: flex; place-items: center; padding-right: calc(var(--section-gap) / 2); } .logo { margin: 0 2rem 0 0; } header .wrapper { display: flex; place-items: flex-start; flex-wrap: wrap; } } </style>
这是一个基于Vue的简单项目代码,其中包含了一个HelloWorld组件和一个TheWelcome组件。还定义了一个count变量和一个numFun函数,用于实现点击按钮后count的自增功能。另外还定义了一个message变量和一个text变量,用于实现输入框的双向绑定和显示输入的内容。还定义了一个radio变量,用于实现单选框的选择功能。代码中还包含了一些样式设置,使页面在不同屏幕宽度下显示效果不同。
阅读全文