fix: 修复视图范围类组件处理变量时没有兼容null值的问题

This commit is contained in:
augushong
2025-03-22 17:11:14 +08:00
parent 40697fe389
commit 103998d8ba
2 changed files with 13 additions and 3 deletions

View File

@@ -270,7 +270,7 @@ function event_handle_result($name, $key, $type = 'all', $params = []) : array
} }
/** /**
* 字符拼接通用处理函数 * 字符拼接通用处理函数.
* *
* @param string $name * @param string $name
* @param string $type * @param string $type
@@ -418,3 +418,13 @@ if (!function_exists('get_site_version_key')) {
return sysconfig('site', 'site_version') . '-' . Version::VERSION . '-' . Version::PRODUCT_VERSION . '-' . Version::LAYUI_VERSION; return sysconfig('site', 'site_version') . '-' . Version::VERSION . '-' . Version::PRODUCT_VERSION . '-' . Version::LAYUI_VERSION;
} }
} }
if (!function_exists('format_null_value')) {
function format_null_value($value)
{
if (is_null($value)) {
return '';
}
return $value;
}
}

View File

@@ -385,7 +385,7 @@ class Cx extends Taglib
if ('$' == $flag || ':' == $flag) { if ('$' == $flag || ':' == $flag) {
$value = $this->autoBuildVar($value); $value = $this->autoBuildVar($value);
$str = 'is_array(' . $value . ')?' . $value . ':explode(\',\',' . $value . ')'; $str = 'is_array(' . $value . ')?' . $value . ':explode(\',\',format_null_value(' . $value . '))';
} else { } else {
$value = '"' . $value . '"'; $value = '"' . $value . '"';
$str = 'explode(\',\',' . $value . ')'; $str = 'explode(\',\',' . $value . ')';