a(href="#" id="pickndroppoints" data-pickuppoints="[{"Id":"HGHD","Time":"2014-01-28 21:00:00.0","Name":"Beach Road"}]")
jade compile给出语法错误意外的标识符
有办法做到这一点吗?我需要发送json并基于它使用js
触发某些事件答案 0 :(得分:1)
data-pickuppoints
的属性值正在突破。
data-pickuppoints="[{"Id":"HGHD","Time":"2014-01-28 21:00:00.0","Name":"Beach Road"}]"
因为你在json数据中有双引号。使它像
data-pickuppoints='[{"Id":"HGHD","Time":"2014-01-28 21:00:00.0","Name":"Beach Road"}]'
或转义双引号
答案 1 :(得分:0)
我会说,因为jade参数是常规的javascript,你只需要使用单引号,所以值不会中断:
a(href="#" id="pickndroppoints" data-pickuppoints='[{"Id":"HGHD","Time":"2014-01-28 21:00:00.0","Name":"Beach Road"}]')
但我不在电脑上,所以我无法测试。