TW-Elements icon indicating copy to clipboard operation
TW-Elements copied to clipboard

Doesn't work when upgrading from v1.0.0-beta1 to v1.0.0-beta2 in Vue

Open tranthaihoang opened this issue 1 year ago • 4 comments

Today after reinstalling node_modules I found that my tailwind elements are not working. After spending a lot of time I found out that the tailwind element version has changed. The document was different from before. I changed according to new document but it also not working. The previous code in the file App.vue It worked fine before:

<script>
import { onMounted } from "vue";

export default {
  setup() {
    onMounted(() => {
      const importTE = async () => {
        await import("tw-elements");
      };
      importTE();
    });
  },
};
</script>

After the change:

<script>
import { onMounted } from "vue";
import { Collapse, Dropdown, initTE } from "tw-elements";

export default {
  setup() {
    onMounted(() => {
      initTE({ Collapse, Dropdown });
    });
  },
};
</script>

But it doesn't work? Hope anyone can help, thanks!

tranthaihoang avatar Apr 20 '23 04:04 tranthaihoang

for my situation,it works

 onMounted(() => {
  setTimeout(() => {
    initTE({ Carousel,Datepicker, Input,Dropdown  });
  }, 1000);   
})

iamyjx avatar Apr 20 '23 07:04 iamyjx

@iamyjx thank you! it worked, but why doesn't the documentation mention this, and they designed it to be backwards compatible with the old version. Luckily there are still people like you!!!!

tranthaihoang avatar Apr 21 '23 03:04 tranthaihoang

What bundler are you using with Vue? Is that default Vue CLI or something else?

Trochonovitz avatar Apr 21 '23 11:04 Trochonovitz

@Trochonovitz Yes, it is default Vue CLI

tranthaihoang avatar May 25 '23 04:05 tranthaihoang