feat: live 模式取消 mock 兼容

This commit is contained in:
carlos.czw 2020-08-19 16:39:04 +08:00
parent 26f4fb132e
commit ab66fd4ca5

View File

@ -9,16 +9,23 @@ function isVariable(obj: any) {
} }
// FIXME: 表达式使用 mock 值未来live 模式直接使用原始值 // FIXME: 表达式使用 mock 值未来live 模式直接使用原始值
// TODO: designType
export function deepValueParser(obj?: any): any { export function deepValueParser(obj?: any): any {
// live if (isJSExpression(obj)) {
if (editor.get('designMode') === 'live') { if (editor.get('designMode') === 'live') {
return obj; return obj;
} }
if (isJSExpression(obj)) {
obj = obj.mock; obj = obj.mock;
} }
// 兼容 ListSetter 中的变量结构 // 兼容 ListSetter 中的变量结构
if (isVariable(obj)) { if (isVariable(obj)) {
if (editor.get('designMode') === 'live'){
return {
type: 'JSExpression',
value: obj.variable,
mock: obj.value,
};
}
obj = obj.value; obj = obj.value;
} }
if (!obj) { if (!obj) {