导入部门时,并非只有JS需要导入,CSS也需要导入
<el-form-item label="使用部门" prop="deptId">
<treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
</el-form-item>
<!--需要导入的js和css(必须)-->
import { treeselect } from '@/api/system/dept'
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import Treeselect from "@riophae/vue-treeselect";
export default {
name: 'Information',
components: { Treeselect },
data() {
return {
// 部门树选项
deptOptions: undefined,
},
methods: {
/** 查询部门下拉树结构 */
getTreeselect() {
treeselect().then(response => {
this.deptOptions = response.data;
});
},
这样修改后,BUG修复