mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-11-09 04:20:50 +08:00
feat(admin-table): 列表双形态注入双端生效,PC 端默认可切卡片
This commit is contained in:
@@ -737,18 +737,16 @@
|
|||||||
// (条目数>1)依赖它,受控分支直接复用。非受控(逃生口)表不
|
// (条目数>1)依赖它,受控分支直接复用。非受控(逃生口)表不
|
||||||
// normalize。
|
// normalize。
|
||||||
var layoutEntries = [];
|
var layoutEntries = [];
|
||||||
var mobileLayoutInjected = false;
|
var autoInjected = false;
|
||||||
// 受控是默认数据流,仅显式 controlled:false 的逃生口页跳过
|
// 受控是默认数据流,仅显式 controlled:false 的逃生口页跳过
|
||||||
if (options.controlled !== false) {
|
if (options.controlled !== false) {
|
||||||
// 手机端未配置 layoutList 时自动启用内置 card(计划
|
// 未配置 layoutList 的受控页双端自动启用内置 card:内置
|
||||||
// table-multiform-rendering Success criteria 2):内置 card
|
// card 无需页面模板(数据全来自渲染上下文),自动注入可行。
|
||||||
// 无需页面模板(数据全来自渲染上下文),自动注入可行。
|
// 注入后条目数>1,双端工具栏自动出现"视图"按钮。显式配置
|
||||||
// 显式配置优先不注入(含 usercard 示例页等存量配置);桌面端
|
// layoutList 的页面仍优先不注入(含 usercard 示例页等存量配置)。
|
||||||
// 不注入,未配置页桌面恒 table 零变化。注入后条目数>1,手机
|
if (!options.layoutList || !options.layoutList.length) {
|
||||||
// 端工具栏自动出现"视图"按钮,可切回 table。
|
|
||||||
if ((!options.layoutList || !options.layoutList.length) && ua.checkMobile()) {
|
|
||||||
options.layoutList = ['table', 'card'];
|
options.layoutList = ['table', 'card'];
|
||||||
mobileLayoutInjected = true;
|
autoInjected = true;
|
||||||
}
|
}
|
||||||
layoutEntries = normalizeLayoutList(options.layoutList);
|
layoutEntries = normalizeLayoutList(options.layoutList);
|
||||||
if (layoutEntries.length > 1) {
|
if (layoutEntries.length > 1) {
|
||||||
@@ -765,11 +763,11 @@
|
|||||||
|
|
||||||
if (options.defaultToolbar === undefined) {
|
if (options.defaultToolbar === undefined) {
|
||||||
options.defaultToolbar = defaultToolbar;
|
options.defaultToolbar = defaultToolbar;
|
||||||
} else if (mobileLayoutInjected) {
|
} else if (autoInjected) {
|
||||||
// 手机自动注入 card 且页面显式配置了 defaultToolbar 时,上方
|
// 自动注入 card 且页面显式配置了 defaultToolbar 时,上方
|
||||||
// push 视图按钮的 defaultToolbar 数组被整体丢弃,"默认 card
|
// push 视图按钮的 defaultToolbar 数组被整体丢弃,"默认 card
|
||||||
// 且可切回 table"会落空,这里对最终配置去重追加(仅注入场景
|
// 且可切回 table"会落空,这里对最终配置去重追加(仅注入场景
|
||||||
// 触发;桌面与显式 layoutList 页均不受影响)
|
// 触发;显式 layoutList 页均不受影响)
|
||||||
var hasLayoutBtn = false;
|
var hasLayoutBtn = false;
|
||||||
$.each(options.defaultToolbar, function (i, btn) {
|
$.each(options.defaultToolbar, function (i, btn) {
|
||||||
if (btn && typeof btn === 'object' && btn.layEvent === 'TABLE_LAYOUT') {
|
if (btn && typeof btn === 'object' && btn.layEvent === 'TABLE_LAYOUT') {
|
||||||
|
|||||||
Reference in New Issue
Block a user