cancel
Showing results for 
Search instead for 
Did you mean: 

Can Magento1 or Magento2 use VUE.js ?

SOLVED

Can Magento1 or Magento2 use VUE.js ?

Is it possible to use  VUE.js in Magento1 or Magento2 ?
Is any one used this, please share me example.

Thanks
Vishal

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Can Magento1 or Magento2 use VUE.js ?

I did some research and found solution.
Write below code in your phtml file.


<html>
<head>
<title>VueJs Introduction</title>
<script type = "text/javascript" src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id = "intro" style = "text-align:center;">
<h1>{{ message }}</h1>
</div>
<script type = "text/javascript">
var vue_det = new Vue({
el: '#intro',
data: {
message: 'My first VueJS Task'
}
});
</script>
</body>
</html>

View solution in original post

3 REPLIES 3

Re: Can Magento1 or Magento2 use VUE.js ?

I did some research and found solution.
Write below code in your phtml file.


<html>
<head>
<title>VueJs Introduction</title>
<script type = "text/javascript" src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id = "intro" style = "text-align:center;">
<h1>{{ message }}</h1>
</div>
<script type = "text/javascript">
var vue_det = new Vue({
el: '#intro',
data: {
message: 'My first VueJS Task'
}
});
</script>
</body>
</html>

Re: Can Magento1 or Magento2 use VUE.js ?

I think this is not a solution, since the CDN should not be used for any productive environment.

Also the issue of distribution files where you leave them?

This would only make it a more templating language, right?

Re: Can Magento1 or Magento2 use VUE.js ?


@braulio_anastac wrote:

I think this is not a solution, since the CDN should not be used for any productive environment.


Why we sould not use CDN for any productive environment?

I need to include Vue.js by CDN instead use Vue PWA Storefront

<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js" type="text/javascript" defer></script>

But this doesn't work