不卡二区-日韩免费在线-欧美a级成人淫片免费看-五月婷婷丁香综合-欧美日韩综合-欧美激情亚洲

產品中心 業內新聞 案例中心 視頻中心

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

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

分類:二次開發 產品中心 低代碼 612

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

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

腳本列子

–[[
? ? 功能說明:
? ? ? ? 1) 顯示前做一些字段的處理
? ? ? ? 2)前端導入,新增有換行符號 %%3Cbr%%3E  ,替換成 <br> 前端html支持的換行內容
? ? ? ? 3)內容中有&,替換成 & 前端解析 &不支持,最好在輸入時進行替換
–]]
json = require(“json”)
mobox = require(“OILua_JavelinExt”)
require(“oi_basestrfunc”)
function BeforeGridShow(strLuaDEID)
? ? local nRet, strRetInfo
? ? local arobjs, attrs, success
? ? — 獲取輸入的DataJson數據包
? ? nRet, strRetInfo = mobox.getCurEditDataPacket(strLuaDEID)
? ? if (nRet ~= 0) then
? ? ? ? mobox.error(strLuaDEID, “無法獲取數據包!”)
? ? ? ? return
? ? end
? ? if (strRetInfo == ” or strRetInfo == nil) then
? ? ? ? return
? ? end
? ? — 解析數據包,數據包格式
? ? — [{“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=”
? ? ? ? — 開始過濾顯示數據對象屬性
? ? ? ? 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
這個列子也可以用于別的一些非法字符串的處理
標簽:低代碼腳本 上一篇: 下一篇:
展開更多
預約軟件體驗

loading...

主站蜘蛛池模板: 台湾三级香港三级在线中文 | 中文字幕一区在线观看 | 中文字幕在线乱码不卡区区 | 国产成人精品亚洲一区 | 亚洲精品综合一区二区三区在线 | 亚州三级视频 | 成人一区二区免费中文字幕 | 国产在线观看网址你懂得 | 99久久综合狠狠综合久久一区 | 欧美自拍视频在线 | 九九精品免费观看在线 | 免费五级在线观看日本片 | 亚洲精品天堂一区在线观看 | 美女黄色一级毛片 | 精品欧美一区二区精品久久 | 国产精品久久久久久福利漫画 | 色偷偷亚洲第一成人综合网址 | 狠狠色噜噜狠狠狠米奇9999 | yy6080福利午夜免费观看 | 欧美大片a一级毛片视频 | 亚洲国产成人久久综合野外 | a毛片基地免费全部香蕉 | 久久精品国产欧美日韩亚洲 | 欧毛片 | 欧美一区永久视频免费观看 | 亚洲国产成人最新精品资源 | 国产一区二区三区在线看 | 日本免费在线视频 | 偶偶福利影院 | 综合亚洲精品一区二区三区 | 亚洲视频在线一区 | 九色porny真实丨国产18 | 亚洲第一黄色网 | 99在线观看精品免费99 | 国产福利久久 | 一区二区三区四区免费视频 | 中文在线com | 一级毛片牲交大片 | 亚洲国产精品久久久久 | 亚洲毛片在线观看 | 日韩久久久精品首页 |