@@ -90,10 +90,12 @@ First, create a function that takes a card object and returns a string of HTML.
9090 flex-direction : column ;
9191 gap : 4px ;
9292 }
93- // other styles
93+ /* other styles */
9494 </style >
9595
9696<script >
97+ const { Booking , template } = booking;
98+
9799 function cardPreviewTemplate ({ card }) {
98100 return `
99101 <div class="custom-preview" data-action="preview-click">
@@ -116,9 +118,11 @@ First, create a function that takes a card object and returns a string of HTML.
116118 </script >
117119~~~
118120
119- Then you need to assign the`cardTemplate` property to your custom template function.
121+ Then you also need to import the template helper and assign the` cardTemplate ` property to your custom template function.
120122
121123~~~ jsx
124+ const { Booking , template } = booking;
125+
122126const widget = new Booking (" #root" , {
123127 data,
124128 cardTemplate: template (card => cardPreviewTemplate (card)),
@@ -436,7 +440,6 @@ To apply a template, you need to define the function that will generate the cust
436440
437441~~~ html
438442<style >
439- /* custom info */
440443 .custom-info {
441444 display : flex ;
442445 flex-direction : column ;
@@ -454,10 +457,12 @@ To apply a template, you need to define the function that will generate the cust
454457 background : rgba (128 , 128 , 155 , 0.12 );
455458 border-radius : 8px ;
456459 }
457- // other styles
460+ /* other styles */
458461 </style >
459462
460463<script >
464+ const { Booking , template } = booking;
465+
461466 function cardInfoTemplate ({
462467 item,
463468 slot,
@@ -481,14 +486,14 @@ To apply a template, you need to define the function that will generate the cust
481486 </script >
482487~~~
483488
484- Then pass the `infoTemplate` function into the Booking configuration as follows:
489+ Then you also need to import the template helper and pass the ` infoTemplate ` function into the Booking configuration as follows:
485490
486491~~~ jsx
492+ const { Booking , template } = booking;
493+
487494const widget = new Booking (" #root" , {
488495 data,
489- infoTemplate : template(item =>
490- cardInfoTemplate(item)
491- ),
496+ infoTemplate: template (item => cardInfoTemplate (item)),
492497});
493498~~~
494499
0 commit comments