引言
jeecg在使用过程常有很多知识点,对开发起着很重要的作用。 现总结如下.
如何获取登录用户信息
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
如果获取登录用户一直为空,原因就是无需认证就可访问,shiro对当前请求没有做用户登录验证,
shiro自然就无法获取当前用了
antd-vue组件失效
在jeecg-vue3开发过程中, 使用antd-vue组件, 经常出现不生效的情况。比如a-typography-text,a-timeline。原因就是main.ts未配置antd-vue
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
const app = createApp(App);
//引入antd-vue
app.use(Antd);
这个问题挺坑,可能是我下载的jeecg版本有点低。 无语了。
jeecg vue3.x 表格自定义渲染效果
import {BasicColumn} from '/@/components/Table';
//该函数已经做了图片渲染,头像渲染等。
import { render } from '/@/utils/common/renderUtils';
export const columns: BasicColumn[] = [
// 以下需求是将文本转换成超链接
{
title: '测试',
dataIndex: 'processDefinitionName',
customRender: ({text}) => {
return h('a', { href: 'https://www.example.com', target: '_blank'}, text)
}
},
//以下需求是将文本转换成标签进行显示
{
title: '标签',
dataIndex: 'tagName',
customRender: ({text}) => {
return return h('font', { color: 'red'}, text)
}
},
}