OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to import a Utils.js file to Vue Repl?

  • Thread starter Thread starter Donut
  • Start date Start date
D

Donut

Guest
Vue Repl repo: https://github.com/vuejs/repl

Is anyone familiar with this module? I want to import a local Utils.js file that contains a few methods to be used in the example, AppVue. Is there a documentation for this module beside the README?


Code:
// Utils.js
export const doSomething = () => {}

// AppVue.text
<script setup> 
import * as Utils from './Utils.js' 
Utils.doSomething('Hi');

// Repl.vue
<script>
const store = new useStore({})

store.setFiles({
  ...store.getFiles(),
  'App.vue': readFileAsStr('./AppVue.text'),
})

// Todo: add Utils.js file 
</script>

<template>
  <Repl :editor="CodeMirror" :store="store" />
</template>

<p>Vue Repl repo: <a href="https://github.com/vuejs/repl" rel="nofollow noreferrer">https://github.com/vuejs/repl</a></p>
<p>Is anyone familiar with this module? I want to import a local Utils.js file that contains a few methods to be used in the example, AppVue. Is there a documentation for this module beside the README?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>// Utils.js
export const doSomething = () => {}

// AppVue.text
<script setup>
import * as Utils from './Utils.js'
Utils.doSomething('Hi');

// Repl.vue
<script>
const store = new useStore({})

store.setFiles({
...store.getFiles(),
'App.vue': readFileAsStr('./AppVue.text'),
})

// Todo: add Utils.js file
</script>

<template>
<Repl :editor="CodeMirror" :store="store" />
</template></code></pre>
</div>
</div>
</p>
 

Latest posts

Top