## cap3自定義控件
1、自定義控件事件注冊
目錄:移動工程/v5/form/js/components/suiCustom.js
示例:
/**
* demo自定義控件-附件,返回html
* @param (html, inputAttrObj, options, auth)
* @returns {string}
*/
api.buildAttaChmentDom = function(html, inputAttrObj, options, auth){
//此處是渲染控件的dom
//如果是relation或者relationform,則修改__state
if (options.fieldInfo.inputType == 'relation' || options.fieldInfo.inputType == 'relationform') {
options.model.__state = 'modified';
}
inputAttrObj['value'] = options.model.value;
inputAttrObj['readonly'] = 'true';
inputAttrObj['class'] += ' sui-hide';
html += '<input ' + cmp.sui.attrBuilder(inputAttrObj) + '/>';
html += '<div ' + cmp.sui.attrBuilder({class: 'sui-form-ctrl-value-display sui-form-ctrl-attachment', id: options.fieldInfo.name}) + '>';
//attachment控件 --start
options.model.attData = options.model.attData || [];
var items = options.model.attData;
if (items.length > 0) {
html += '<div class="attachment-items">';
items.forEach(function(item){
item.remoteSource = !item.remoteSource ? (cmp.util.getSeeyonPath() + '/rest/attachment/file/' + item.fileUrl) : item.remoteSource;
html += ' <div class="attachment-item">';
html += ' <i class="attachment-icon ' + _FileExtensionFilter(item.extension) + '"></i>';
var dom = document.createElement('div');
dom.classList.add('attachment-content');
dom.classList.add('allow-click-attachment');
dom.setAttribute('see-att-data', JSON.stringify(item));
dom.innerHTML = item.filename;
html += dom.outerHTML;
if (auth == 'edit') {
html += ' <i class="see-icon-v5-form-close-circle-fill"></i>';
}
html += ' </div>';
});
} else {
html += '<div class="attachment-items items-empty">';
}
html += '</div>';//items-end
if (auth == 'edit') {
html += '<div class="attachment-add-item">' + (cmp.i18n('form.attachment.uploadLimit') || 'Please upload file which limited as 50MB') +
' <div class="icon-add">' +
' <i class="see-icon-v5-form-add"></i>' +
' </div>' +
' </div>';
}
html += '</div>';
//attachment控件 --end
html +='</div>';
return html
}
2、自定義調用
目錄:移動工程/v5/form/js/components/sui_utils.js
示例:
case 'customcontrol':
if(options.model.customType&&options.model.customType!='text'){
//自定義控件 -demo
inputAttrObj['customType'] = options.model.customType;
switch (inputAttrObj['customType']){
case 'attachment':
html += SuiCustom.buildAttaChmentDom (html, inputAttrObj, options, auth)
break;
default:
break;
}
}else{
inputAttrObj['value'] = options.model.value;
inputAttrObj['readonly'] = 'true';
inputAttrObj['class'] += ' sui-hide';
html += '<input ' + $.sui.attrBuilder(inputAttrObj) + '/>';
html += '<div ' + $.sui.attrBuilder({class: 'sui-form-ctrl-value-display sui-form-ctrl-static ' + (!options.model.value ? 'sui-form-placeholder' : ''), id: options.fieldInfo.name}) + '>' + (options.model.display || options.fieldInfo.desc || '').escapeHTML() + '</div>';
}
break;
- 概要
- 技術介紹
- 框架與環境
- vue開發
- 開發規范
- 前端開發規范
- 總體原則
- HTML規范
- HTML&css規范
- vue編碼規范
- Javascript規范
- 后端開發規范
- cap4
- 自定義控件
- 前端2.0(PC+移動)
- PC前端
- 后端
- 移動端
- 移動端接口
- 低版本協同升級到V5 8.0適配說明
- 自定義按鈕
- 自定義按鈕(無流程)
- 自定義控件(列表插槽)
- 自定義按鈕(篩選條件)
- 低版本協同升級到V5 8.0適配說明
- 門戶空間
- 門戶與欄目掛載
- 欄目開發及流程說明
- 頁面模板
- 客開通路及插件體系
- 表單設計器擴展配置
- 使用步驟
- 配置說明
- 事件API
- Demo示例
- 運行態客開通路
- 插件使用步驟
- 插件接口
- 事件接口
- 鉤子相關接口
- 表單操作接口
- Demo示例
- 插件機制
- 表單運行態接口(舊)
- 白名單插件
- 版本記錄
- vue組件庫
- 開發指南
- 開發文檔規范
- 業務組件介紹
- 業務組件
- table組件
- 分頁組件
- title組件
- 統計排隊組件
- code組件
- 條件篩選
- 批量導入
- 上傳Excel
- 批量更新
- 批量刷新
- UI組件
- 按鈕組件
- 復選組件
- 取色器組件
- 示例組件
- 水平選擇組件
- 選圖標組件
- 提示組件
- 單選組件
- 搜索組件
- 選擇組件
- 穿梭框組件
- 標簽組件
- 文本組件
- 樹組件
- 驗證組件
- 菜單組件
- iframe組件
- toolbar
- 統計組件
- 餅圖
- 柱狀圖
- 圖標
- 業務關系開發指南
- 自定義觸發
- 自定義關聯
- 后端API
- 更新表單數據緩存
- 發起表單流程
- 取得指定表單PDF或截圖
- 無流程批量添加
- 無流程批量刪除
- 無流程批量更新
- 無流程批量導出
- 客開培訓文檔
- Vue基礎培訓
- Vue實戰培訓
- Vue進階培訓
- VueCLI3培訓
- cap3
- 自定義控件
- 后端
- 移動端
- 前端編譯
- 表單運行態接口
- 協同云