<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Event handler directive not support for components in vue framework? in Calcite Design System Questions</title>
    <link>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1215420#M237</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/574219"&gt;@KittyHurley&lt;/a&gt;&amp;nbsp;it works, thanks so much.&amp;nbsp; Here I post the&lt;A href="https://stackblitz.com/edit/vitejs-vite-qbfkh1?file=package.json" target="_self"&gt; example project in stackblitz.&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 23 Sep 2022 06:36:41 GMT</pubDate>
    <dc:creator>baohuachu2</dc:creator>
    <dc:date>2022-09-23T06:36:41Z</dc:date>
    <item>
      <title>Event handler directive not support for components in vue framework?</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1214503#M228</link>
      <description>&lt;P&gt;There is "@esri/calcite-components-react" which support react.&amp;nbsp; &amp;nbsp;The event handler can be written as:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;CalciteButton onClick={(e) =&amp;gt; setSliderValue(0)}&amp;gt;
        Reset
&amp;lt;/CalciteButton&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;While in vue , it not work as this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;calcite-action @click="count++"&amp;gt;Add&amp;lt;/calcite-action&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 21 Sep 2022 07:50:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1214503#M228</guid>
      <dc:creator>baohuachu2</dc:creator>
      <dc:date>2022-09-21T07:50:27Z</dc:date>
    </item>
    <item>
      <title>Re: Event handler directive not support for components in vue framework?</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1214690#M229</link>
      <description>&lt;P data-unlink="true"&gt;There are a few example applications with Calcite components, &lt;A href="https://github.com/Esri/calcite-components-examples/tree/master/vue/vue3" target="_blank" rel="noopener"&gt;including an example for Vue 3&lt;/A&gt;, which contains some setup guidance.&lt;/P&gt;&lt;P data-unlink="true"&gt;Once the project is setup from the &lt;A href="https://github.com/Esri/calcite-components-examples/tree/master/vue/vue3#readme" target="_blank" rel="noopener"&gt;accompanying README steps&lt;/A&gt;&amp;nbsp;you should be able to use Vue's event handlers.&lt;/P&gt;&lt;P data-unlink="true"&gt;Was able to successfully run the following code below in the&amp;nbsp;src/components/HelloWorld.vue project file:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;template&amp;gt;
    &amp;lt;calcite-action @click="count++" text="Add 1" text-enabled&amp;gt;&amp;lt;/calcite-action&amp;gt;
    &amp;lt;p&amp;gt;Count is: {{ count }}&amp;lt;/p&amp;gt;
&amp;lt;/template&amp;gt;

&amp;lt;script&amp;gt;
import '@esri/calcite-components/dist/components/calcite-action';

export default {
  data() {
    return {
      count: 0
    }
  },
};

&amp;lt;/script&amp;gt;

&amp;lt;style src="@esri/calcite-components/dist/calcite/calcite.css"&amp;gt;&amp;lt;/style&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;To run locally, &lt;A href="https://github.com/Esri/calcite-components-examples/tree/master/vue/vue3#adding-the-assets" target="_blank" rel="noopener"&gt;copy static assets to the public folder manually&lt;/A&gt;, and then serve:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;npm run copy
npm run serve&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2022 16:24:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1214690#M229</guid>
      <dc:creator>KittyHurley</dc:creator>
      <dc:date>2022-09-21T16:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Event handler directive not support for components in vue framework?</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1215420#M237</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/574219"&gt;@KittyHurley&lt;/a&gt;&amp;nbsp;it works, thanks so much.&amp;nbsp; Here I post the&lt;A href="https://stackblitz.com/edit/vitejs-vite-qbfkh1?file=package.json" target="_self"&gt; example project in stackblitz.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Sep 2022 06:36:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1215420#M237</guid>
      <dc:creator>baohuachu2</dc:creator>
      <dc:date>2022-09-23T06:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Event handler directive not support for components in vue framework?</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1216369#M241</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/574219"&gt;@KittyHurley&lt;/a&gt;&amp;nbsp; These days I tried "calcite-date-picker" component.&amp;nbsp; To bind its "&lt;A href="https://developers.arcgis.com/calcite-design-system/components/date-picker/#component-api-events-calciteDatePickerChange" target="_blank" rel="noopener"&gt;calciteDatePickerChange&lt;/A&gt;" event in Vue comonent but there is no any respond in its triggered event handler. The code snippet is as :&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;template&amp;gt;
    &amp;lt;calcite-date-picker range   @calciteDatePickerRangeChange="dateChange"&amp;gt;&amp;lt;/calcite-date-picker&amp;gt;
&amp;lt;/template&amp;gt;
&amp;lt;script setup&amp;gt;
 
import '@esri/calcite-components/dist/components/calcite-date-picker';

const dateChange = ( ) =&amp;gt; {
  console.log("date Changed");
}
&amp;lt;/script&amp;gt;

&amp;lt;style src="@esri/calcite-components/dist/calcite/calcite.css"&amp;gt;&amp;lt;/style&amp;gt;
​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 03:34:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1216369#M241</guid>
      <dc:creator>baohuachu2</dc:creator>
      <dc:date>2022-09-27T03:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: Event handler directive not support for components in vue framework?</title>
      <link>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1216804#M246</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/115883"&gt;@baohuachu2&lt;/a&gt;, this appears to be a &lt;A href="https://github.com/vuejs/core/issues/5401" target="_blank" rel="noopener"&gt;Vue related issue regarding syntax capitalization&lt;/A&gt;, which relates to how Calcite's names events, including "calciteDatePickerChange".&lt;/P&gt;&lt;P&gt;There is a workaround in the meantime (&lt;EM&gt;posted&amp;nbsp;below&lt;/EM&gt;). We've also updated the workaround to the &lt;A href="https://github.com/Esri/calcite-components-examples/tree/master/vue/vue3" target="_blank" rel="noopener"&gt;Vue 3 example&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;script&amp;gt;
import '@esri/calcite-components/dist/components/calcite-date-picker';
/**
 * This is a workaround for listening to custom events
 * that contain capital letters.  Adapted from:
 * https://github.com/vuejs/core/issues/5401#issuecomment-1041214293
 */
const eventDirective = {
  beforeMount(el, { arg, value }) {
    console.log(arg); // casing is preserved, check console
    el.addEventListener(arg, value);
  },
  beforeUnmount(el, { arg, value }) {
    el.removeEventListener(arg, value);
  },
};
export default {
  methods: {
    datePickerRangeChangeHandler(event) {
      console.log(
        'datePickerRangeChangeHandler',
        event.detail,
      );
    },
  },
  directives: {
    event: eventDirective,
  },
};
&amp;lt;/script&amp;gt;

&amp;lt;style src="@esri/calcite-components/dist/calcite/calcite.css"&amp;gt;&amp;lt;/style&amp;gt;

&amp;lt;template&amp;gt;
    &amp;lt;calcite-date-picker
      range
      v-event:calciteDatePickerRangeChange="datePickerRangeChangeHandler"
    &amp;gt;&amp;lt;/calcite-date-picker&amp;gt;
&amp;lt;/template&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Sep 2022 00:09:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/calcite-design-system-questions/event-handler-directive-not-support-for-components/m-p/1216804#M246</guid>
      <dc:creator>KittyHurley</dc:creator>
      <dc:date>2022-09-28T00:09:40Z</dc:date>
    </item>
  </channel>
</rss>

