2

estoy desarrollando una admin para tener todo la información de mis clientes y tengo un problema con .

Puedo ver la pantalla sin problemas, pero el botón botón no funciona. Este es el código del botón:

<inertia-link
 :href="route('clientes.create')"
 class=" type="button">
   Nuevo Cliente
</inertia-link>

El scrip que tengo al final es:

import JetApplicationLogo from '@/Jetstream/ApplicationLogo.vue'
    import AppLayout from '@/Layouts/AppLayout'
    import { Link } from '@inertiajs/inertia-vue3'

    export default {
        props:{
        productos: Array
       },
        components: {
            JetApplicationLogo,
            Link,
        },
    };

En la consola sale esto:

[Vue warn]: Failed to resolve component: inertia-link 
  at <ClienteMostrar> 
  at <AppLayout title="Clientes" > 
  at <Clientes jetstream= 
Object { canCreateTeams: false, canManageTwoFactorAuthentication: true, canUpdatePassword: true, canUpdateProfileInformation: true, flash: [], hasAccountDeletionFeatures: true, hasApiFeatures: false, hasTeamFeatures: false, hasTermsAndPrivacyPolicyFeature: false, managesProfilePhotos: true }
 user= 
Object { id: 1, name: "Oscar", email: "mail@mail.com", email_verified_at: "fecha", current_team_id: null, profile_photo_path: null, created_at: "fecha", updated_at: "fecha", profile_photo_url: "https://ui-avatars.com/api/?name=Oscar&color=7F9CF5&background=EBF4FF", two_factor_enabled: false }
 errorBags= 
Array []
  ... > 
  at <Inertia initialPage= 
Object { component: "Clientes", props: {…}, url: "/clientes", version: "207fd484b7c2ceeff7800b8c8a11b3b6" }
 initialComponent= 
Object { components: {…}, render: render(_ctx, _cache, $props, $setup, $data, $options)
, __file: "resources/js/Pages/Clientes.vue", inheritAttrs: false, … }
 resolveComponent=fn<m>  ... > 
  at <App>

Gracias por su ayuda :)

4
  • No conozco inertia, pero posiblemente porque en components usas Link, y el template inertia-link. Que pasa si en el template usas <Link :href="..." type="button">Nuevo Cliente</Link>. Además parece que tienes una comilla sin cerrar en el atributo class el 3 ago. 2021 a las 18:06
  • Hola, gracias. La comilla puede que se me escapará cuando saqué toda la clase, para que no quedará tanta largo. Probe con <Link> pero no fucniona.
    – Oscar
    el 3 ago. 2021 a las 19:01
  • Y te dá el mismo error? el 3 ago. 2021 a las 19:05
  • En consola no da error, pero tampoco hace nada el botón. Hago click y nada
    – Oscar
    el 3 ago. 2021 a las 19:27

1 respuesta 1

0

Te olvidas de poner AppLayout en los componentes a exportar, tal vez sea eso, tenía el mismo problema, pero yo lo solucioné cambiando todos los inertia-link por Link solamente y poniendo:

import { Link } from '@inertiajs/inertia-vue3

y en export default

components:{ AppLayout, Link }

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.