S
S
Sergeyjed2019-03-23 22:09:15
Vue.js
Sergeyjed, 2019-03-23 22:09:15

How to use same script in different vue.js pages?

The script code is repeated on several pages, if you create a component, then you need to transfer the entire layout of the content with the content to it, are there any other ways? Here's how in the modal window plugin, where the content is wrapped in a modal tag, I need the same solution.
example page as you would like

<template>
  <content>
     <!-- тут много верстки с контентом -->
  </content>
</template>

<script> подхватывается из content  </script>
 
<style>  подхватывается из content </style>

and content will contain part of the layout and all scripts
<template>
  <div>
     <!-- тут контент страницы -->
  </div>
</template>

<script> 
  // тут код
 </script>
 
<style> 
  // тут стиль
</style>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question