freemark 自定义常用函数

原创
2019/04/09 18:18
阅读数 26
<#--
		css 依赖
		use: <@cssDeps ["ztree"] />
-->
<#macro cssDeps fileNames=[]>
	<#if fileNames?size != 0 >
		<#list fileNames as file>
			<#if "jqueryUI" == file>
				<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
				<#elseif "ztree" == file>
				<link media="all" rel="stylesheet" type="text/css" href="${staticFileUrl}/jui/plugins/ui/zTree/css/zTreeStyle/zTreeStyle.css" />
			</#if>
		</#list>
	</#if>
</#macro>

<#macro jsDeps fileNames=[] remove={}>
<#if fileNames?size != 0 >
	<#list fileNames as file>
		<#if "jqueryUI" == file>
		<#elseif "jqueryForm" == file>
		<#elseif "template" == file>
		<script type="text/javascript" src="${pathJs}/artTemplate/template.min.js"></script>
		<#elseif "autocomplete" == file>
		<script type='text/javascript' src='${pathJs}/jquery.autocomplete/jquery.autocomplete.js'></script>
		<#elseif "ztree" == file>
		<script type="text/javascript" src="${staticPath}/jui/plugins/ui/zTree/js/jquery.ztree.all.min.js"></script>
		</#if>
	</#list>
</#if>
</#macro>

<#function eq s1="" s2="" el="">
	<#if s1 == s2>
		<#return el>
	</#if>
	<#return "">
</#function>
<#function map map={} key="" isBoolean=false isObject=true>
	<#if map[key]?? && map?keys?size != 0>
		<#return map[key]>
	<#else>
		<#if isBoolean>
			<#return false>
		<#elseif isObject>
			<#return {}>
		</#if>
	</#if>
</#function>

<#function substr text="" len=20>
	<#if text?length lt len>
		<#return text />
	<#else>
		<#return text[0..len] />
	</#if>
</#function>

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部