julio manuel chan martin

Joined

10 Experience
0 Lessons Completed
0 Questions Solved

Activity

Hi, what about if I'm using my files like :

poular_vue.js :

import Vue from 'vue'
import Popular from './popular.vue'

document.addEventListener('DOMContentLoaded', () => {
document.body.appendChild(document.createElement('popular'))
const popular = new Vue(Popular).$mount('popular')

})

popular.vue

<div v-for="nota in notas_p">
<div class="col-sm-3 post post-6">
<div class=" m0 inner">
<div class=" m0 featured_img">
<img v-bind:src="nota.image_url" alt="">
</div>
<div class=" m0 post_contents">
<div class="m0 category sports">
</div>
<h3 class="post_title">
{{nota.name}}
</h3>
<ul class="post_meta nav nav-pills">
<li></li>
</ul>
</div>
</div>
</div>
export default {
data: {
notas_p: []
},
mounted() {
axios.get("xxxxxxxxxxx")
.then(response => {
this.notas_p = response.data
})
},
}

(note: I am using Axios to get information from an Api)
and them I insert the vue component in the rails view like this :

<%= javascript_pack_tag 'popular_vue' %>

this how should I modified my code to move from one view to another taking the params like name and other information

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

© 2023 GoRails, LLC. All rights reserved.