如何在表达式中使用 属性?
How to use property within expression?
我的 GeoJSON 文件中有一个名为 "bla" 的 属性。
"text-field": [
'case',
['!=', ['get', 'bla'], null],
"{bla}%",
['==', ['get', 'bla'], null],
" ",
" ",
],
我想在 case 表达式中显示 属性,但它不起作用。
如果我简单地通过:
"text-field": "{bla}%"
它工作得很好。
如何在 case 表达式中使用属性?
谢谢
使用 concat 代替占位符:
"text-field": [
"case", ['!=', ['get', 'bla'], null],
["concat", ['get', 'bla'], '%'],
['==', ['get', 'bla'], null],
" ",
" "
]
我的 GeoJSON 文件中有一个名为 "bla" 的 属性。
"text-field": [
'case',
['!=', ['get', 'bla'], null],
"{bla}%",
['==', ['get', 'bla'], null],
" ",
" ",
],
我想在 case 表达式中显示 属性,但它不起作用。
如果我简单地通过:
"text-field": "{bla}%"
它工作得很好。
如何在 case 表达式中使用属性?
谢谢
使用 concat 代替占位符:
"text-field": [
"case", ['!=', ['get', 'bla'], null],
["concat", ['get', 'bla'], '%'],
['==', ['get', 'bla'], null],
" ",
" "
]