Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- <div class = "col-9 " >
- <div class = "col-sm" v-for = "oferta in ofertas": key = "oferta.id" >
- <img class = "img-circle": src = "getFoto()" alt = "" >
- <div class = "card-body" >
- <h5 class = "card-title" > {{ oferta.foto }} < /h5>
- <p class = "card-text" > {{ oferta.precioNormal }} < /p>
- <!-- <a href="/usuarios/{{oferta.precioOferta}}" class="btn btn-primary">Ver mas </a>-->
- </div>
- </div>
- </div>
- </template>
- <script >
- export default {
- data() {
- return {
- ofertas: {},
- foto: ''
- ////data////
- }
- },
- methods: {
- getFoto() {
- return "img/profile/" + this.foto;
- },
- /*--------------------------------------------------------------*/
- //cargo las ofertas
- cargarOferta() {
- //pregunto con axios a la ruta del servidor de la API
- axios.get("api/oferta").then(({
- data
- }) => (this.ofertas = data.data));
- }
- },
- created() {
- this.cargarOferta();
- Fire.$on('AfterCreate', () => {
- this.cargarOferta();
- })
- // setInterval(()=>this.cargarOferta(),3000);
- }
- }
- </script>
- public function index()
- {
- return oferta::latest()->paginate(10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement