Home » vue » How to use Vue.js element without npm?

How to use Vue.js element without npm?

Posted by: admin November 26, 2021 Leave a comment

Questions:

Is it possible to use a component without having npm?

I’m trying to make https://www.npmjs.com/package/vue-bootstrap4-table#4-basic-usage work but it fails.

I can’t import component inside html file.

Tried:

import VueBootstrap4Table from 'vue-bootstrap4-table';

app = new Vue({
  el: '#app',
  data: {
    rows: [{

Here is the fiddle.

What is wrong with this code?

Answers:

remove:

import VueBootstrap4Table from 'vue-bootstrap4-table';

and

...,
components: {
  VueBootstrap4Table
}

from the bottom of your Vue instance – by adding the CDN reference, it’s already included.

Then lastly, looks like you were missing the bootstrap css for this table. I added it as a dependency in the fiddle.

check it out:

https://jsfiddle.net/u4twL905/