[英]How to use property within expression?
I have a property in my GeoJSON file that is called "bla". 我的GeoJSON文件中有一个称为“ bla”的属性。
"text-field": [
'case',
['!=', ['get', 'bla'], null],
"{bla}%",
['==', ['get', 'bla'], null],
" ",
" ",
],
I would like to display that property within a case expression, which is not working. 我想在案例表达式中显示该属性,但无法正常工作。
If I simply pass: 如果我简单地通过:
"text-field": "{bla}%"
it is working just fine. 它工作正常。
How do I use properties within that case expression? 如何在该case表达式中使用属性?
Thanks 谢谢
Use concat instead placeholder: 使用concat代替占位符:
"text-field": [
"case", ['!=', ['get', 'bla'], null],
["concat", ['get', 'bla'], '%'],
['==', ['get', 'bla'], null],
" ",
" "
]
[ https://jsfiddle.net/sxma7u68/ ] [ https://jsfiddle.net/sxma7u68/ ]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.