0

我有一个register-task-popup可以使用personId数据的组件:

<register-task-popup
    person-id="${personId}"
    chat-customer-information='${JSON.stringify(chatCustomerInformation)}'
</register-task-popup>`;

数据是可选的personId,有时可用,有时不可用。是否可以仅在未定义person-id时添加属性?personId

4

1 回答 1

1

像下面这样的东西对我有用 -

<register-task-popup 
 {{( personId == '') ? "" : "person-id=''"+ personId+"''" }} chat-customer- 
 information='${JSON.stringify(chatCustomerInformation)}'>
 </register-task-popup>`;
于 2019-12-13T11:17:04.540 回答