Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

538
Vistas
How to apply component in antdesign with vue-cli and vue 3?

I already follow the instruction on the docs here.

This is what I did

vue create example-app
cd example-app

I choose the vue 3 preset.

then change the script in main.js

import Vue from 'vue';
import Button from 'ant-design-vue/lib/button';
import 'ant-design-vue/dist/antd.css';
import App from './App';

Vue.component(Button.name, Button);

Vue.config.productionTip = false;

new Vue({
  render: h => h(App),
}).$mount('#app');

here's my App.js file

<template>
  <div id="app">
    <img src="./assets/logo.png">
    <a-button type="primary">Button</a-button>
  </div>
</template>

<script>

export default {
  name: 'App',
  components: {
  }
}
</script>

<style>

</style>

But why there is no Button component on the screen? all I got is blank screen

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

I've failed to reproduce what's mentioned here. the code works perfectly. I think probably there's something left out from your writing.

here's the working code. try compare this with yours.

https://codesandbox.io/s/cocky-leftpad-hbi3i?file=/src/App.vue


For Vue 3, things are still pretty much the same. Vue 3 uses different plugin install method.

// main.js
import { createApp } from 'vue'
import App from './App.vue'
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';

const app = createApp(App)

app.use(Antd) // same as Vue.use in Vue 2.X
app.mount('#app')

this code isn't mine but it shows the same thing.

https://codesandbox.io/s/vue3-antd-xzk1x?file=/src/main.js

over 4 years ago · Santiago Trujillo Denunciar

0

enter image description here

I just ran the project and this is the displayed result.

Steps I followed.

  1. npm install -g @vue/cli
  2. vue create antd-demo
  3. I selected the vue2 preset
  4. cd antd-demo
  5. npm install ant-design-vue
  6. modified src/main.js (as per docs)
  7. modified src/App.vue (as per docs)
  8. npm run serve
over 4 years ago · Santiago Trujillo Denunciar

0

In my case, my fault was that I chose vue3 and followed instructions in https://antdv.com/docs/vue/getting-started/, but had to follow https://2x.antdv.com/docs/vue/getting-started

npm i --save ant-design-vue@next

(@next !)

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda