vue3开发,遇到一个报错:
Unexpected useless attribute on `<template>` vue/no-useless-template-attribues
就是说tempate标签属性有问题:
仔细排查了下,发现不知道哪个粗心的同事,竟然给template加了class样式,错误代码如下:
<searchTools :isopenshow="false" :showFilter="false"> <template #searchContent class="searchContent"> <el-form v-model="SForm" :inline="true" class="demo-form-inline" ref="searchForm"> <el-form-item label="角色名称" prop="name"> <el-input v-model="SForm.name" clearable placeholder="请输入角色名称" /> </el-form-item> </el-form> </template> <template #searchBtn class="searchContent"> <el-button-group> <el-button type="primary" title="查询" icon="el-icon-search" @click="upsearch" /> <el-button title="重置" icon="el-icon-refresh-left" @click="resetSearch" /> </el-button-group> </template> </searchTools>
把class去掉就可以了,如果要加这个样式,可以加到template的里面或外面:
<searchTools :isopenshow="false" :showFilter="false"> <template #searchContent> <el-form v-model="SForm" :inline="true" class="demo-form-inline" ref="searchForm"> <el-form-item label="角色名称" prop="name"> <el-input v-model="SForm.name" clearable placeholder="请输入角色名称" /> </el-form-item> </el-form> </template> <template #searchBtn> <el-button-group> <el-button type="primary" title="查询" icon="el-icon-search" @click="upsearch" /> <el-button title="重置" icon="el-icon-refresh-left" @click="resetSearch" /> </el-button-group> </template> </searchTools>