xxxxxxxxxx
<html>
<head>
<script type="importmap">
{
"imports": {
"vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js"
}
}
</script>
<body>
<div id="app">
<h2>Vue js Array join function</h2>
<p>Vue JS Convert Array to Comma Separated String Example</p>
<p>Array : {{demoArray}}</p>
<button @click="myFunction">return array as string</button>
<p></p>
<p>String : {{result}}</p>
</div>
<script type="module">
import { createApp } from 'vue'
createApp({
data()
{
return{
demoArray:['Australia','England','America','India','China','Russia'],
result : ''
}
},
methods:{
myFunction(){
this.result = this.demoArray.join();
},
}
}).mount('#app')
</script>
</body>
</head>
</html>