elementui中label标签添加自定义图标
作者:互联网
<template> <div class="hello"> <el-form> <el-row> <el-col :span="5"> <div class="grid-content bg-purple"> <el-form-item label-width="120px"> <span slot="label"> <span class="span-box"> <span>主食 :</span> <i class="el-icon-tableware ico-pre"></i> </span> </span> <el-radio v-model="radio" label="1">饺子</el-radio> <el-radio v-model="radio" label="2">米饭</el-radio> </el-form-item> </div> </el-col> </el-row> <el-row> <el-col :span="5"> <div class="grid-content bg-purple"> <el-form-item label-width="120px"> <span slot="label"> <span class="span-box"> <span>喜欢的配菜 :</span> <i class="el-icon-dish-1 ico-pre"></i> </span> </span> <el-radio v-model="radio1" label="3">千页豆腐</el-radio> <el-radio v-model="radio1" label="4">空心菜</el-radio> </el-form-item> </div> </el-col> </el-row> </el-form> </div> </template> <script> export default { name: 'HelloWorld', props: { msg: String }, data () { return { radio: '1', radio1:'4' }; } } </script> <style scoped> .span-box{ display:inline-block; position:relative; } .ico-pre{ position:absolute; left:-21px; top:12px; } </style>
效果图
标签:pre,12px,自定义,elementui,label,relative,配菜,position 来源: https://www.cnblogs.com/cocoaguo/p/12151897.html