D
D
dicem2019-05-06 16:06:32
Electronic components
dicem, 2019-05-06 16:06:32

Is it correct to include third-party scripts in App.vue using Vue CLI?

I just had an interview, there was a question regarding my test task.
The App.vue root component had the following picture:

<script src="./assets/bootstrap/js/bootstrap.min.js"></script>
<script>
  Date.prototype.yyyymmdd = function() {
    var mm = this.getMonth() + 1
    var dd = this.getDate()
    return [this.getFullYear(),
      ( mm > 9 ? '' : '0' ) + mm,
      ( dd > 9 ? '' : '0' ) + dd
    ].join('')
  }
  
  export default {
    data() {
      return {
        menuShow: false,
        linkMenu: [
          { title: 'Home', url: '/' },
          { title: 'All Tasks', url: '/tasks' }
        ]
      }
    }
  }
</script>

There was a question next "How correct is the connection of the bootstrap script and the connection of the method of the Date object inside the App.vue component?"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lavezzi1, 2019-05-06
@dicem

In my opinion, it would be correct to install bootstrap via npm, import it into main.js and make some global settings there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question