日韩欧美一区二区久久-日韩欧美一区二区三区-日韩欧美一区二区三区不卡-日韩欧美一区二区三区不卡视频-日韩欧美一区二区三区不卡在线

產(chǎn)品中心 業(yè)內(nèi)新聞 案例中心 視頻中心

lua 對回車(%3Cbr%3E)處理方法 lua 對回車(%3Cbr%3E)處理方法

lua 對回車(%3Cbr%3E)處理方法

我們在Gird列出數(shù)據(jù)的時候,若數(shù)據(jù)內(nèi)帶%3Cbr%3E,其實是回車的意思,若grid讀出數(shù)據(jù)不做任何處理,那么就會影響系統(tǒng)表達

為了解決這個問題,我們可以編輯一個lua腳本,將這個數(shù)據(jù)做處理后再顯示(在顯示前事件里面定義這個lua腳本)

腳本列子

–[[
? ? 功能說明:
? ? ? ? 1) 顯示前做一些字段的處理
? ? ? ? 2)前端導(dǎo)入,新增有換行符號 %%3Cbr%%3E  ,替換成 <br> 前端html支持的換行內(nèi)容
? ? ? ? 3)內(nèi)容中有&,替換成 & 前端解析 &不支持,最好在輸入時進行替換
–]]
json = require(“json”)
mobox = require(“OILua_JavelinExt”)
require(“oi_basestrfunc”)
function BeforeGridShow(strLuaDEID)
? ? local nRet, strRetInfo
? ? local arobjs, attrs, success
? ? — 獲取輸入的DataJson數(shù)據(jù)包
? ? nRet, strRetInfo = mobox.getCurEditDataPacket(strLuaDEID)
? ? if (nRet ~= 0) then
? ? ? ? mobox.error(strLuaDEID, “無法獲取數(shù)據(jù)包!”)
? ? ? ? return
? ? end
? ? if (strRetInfo == ” or strRetInfo == nil) then
? ? ? ? return
? ? end
? ? — 解析數(shù)據(jù)包,數(shù)據(jù)包格式
? ? — [{“id”:””,”attrs”:[{“attr”:””,”value”:””},..]},..]
? ? local n, nCount
? ? success, arobjs = pcall(json.decode, strRetInfo)
? ? if (success == false) then
? ? ? ? mobox.error(strLuaDEID, “非法的JSON格式!”)
? ? ? ? return
? ? end
? ? nCount = #arobjs
? ? if (nCount == 0) then
? ? ? ? return
? ? end
? ? local obj, attrs
? ? local nattr_count
? ? local strRow, strAttr, strItem
? ? local strDataJson
? ? local id, strValue
? ? local strAttrs
? ? strDataJson = ‘[‘
? ? local seg = {}
? ? local nSegCount = 0
? ? for n = 1, nCount do
? ? ? ? obj = arobjs[n]
? ? ? ? attrs = obj.attrs
? ? ? ? nattr_count = #attrs
? ? ? ? id = obj.id
? ? ? ? strAttrs=”
? ? ? ? — 開始過濾顯示數(shù)據(jù)對象屬性
? ? ? ? for nIndex = 1, nattr_count do
? ? ? ? ? ? strAttr = attrs[nIndex].attr
? ? ? ? ? ? strValue = attrs[nIndex].value
? ? ? ? ? ? strValue = strValue:gsub(“%%3Cbr%%3E”, “<br>”)
? ? ? ? ? ? strValue = strValue:gsub(“&”, “&”)
? ? ? ? ? ? strItem = ‘{“attr”:”‘ .. strAttr .. ‘”,”value”:”‘ .. strValue .. ‘”},’
? ? ? ? ? ? strAttrs = strAttrs .. strItem
? ? ? ? end
? ? ? ? — 取消最后一個,號
? ? ? ? strAttrs = trim_laster_char(strAttrs)
? ? ? ? strRow = ‘{“id”:”‘ .. id .. ‘”,”attrs”:[‘ .. strAttrs .. ‘]},’
? ? ? ? strDataJson = strDataJson .. strRow
? ? end
? ? — 取消最后一個,號
? ? strDataJson = trim_laster_char(strDataJson)
? ? strDataJson = strDataJson .. ‘]’
? ? local strAction = ‘[{“action_type”:”reset_data_attr”,”value”:’ .. strDataJson .. ‘}]’
? ? mobox.setAction(strLuaDEID, strAction)
end
這個列子也可以用于別的一些非法字符串的處理
標簽:低代碼腳本 上一篇: 下一篇:
展開更多
預(yù)約軟件體驗

loading...

主站蜘蛛池模板: 久久香蕉国产线看观看99 | 激情久久婷婷 | 国产精品福利网站 | 久久综合精品不卡一区二区 | 很黄很黄的毛片欧美 | 亚洲综合久久一本伊伊区 | 国产特级毛片 | 国产精品啪 | 欧美在线视频一区 | 清纯唯美亚洲综合一区 | 国产精品美女自拍 | 亚洲高清日韩精品第一区 | 精品欧美在线观看视频 | 一区二区在线观看视频在线 | 污视频网站免费 | 北岛玲日韩精品一区二区三区 | 欧美一级日本一级韩国一级 | 中国精品视频一区二区三区 | 国产精品嫩草影院午夜 | 欧美日韩一区二区三区毛片 | 国产v在线播放 | 亚洲精品自拍愉拍第二页 | 久久青青草视频 | 黄+在线播放 | www.欧美黄色| 欧美日韩高清不卡一区二区三区 | 国产a毛片清高视频 | 午夜黄色 | 麻豆网站视频国产在线观看 | 99九九成人免费视频精品 | 中文无码久久精品 | 青青伊人网 | 国产a级三级三级三级 | 国产精品va欧美精品 | 久久麻豆亚洲精品 | 成人免费淫片免费观看 | 亚洲精品第一国产综合高清 | 婷婷色天使在线视频观看 | 日韩在线高清 | 亚洲欧美精品一区 | 中文字幕最新在线 |