How to Use the Bulma Framework in Vue3
Sometimes you need to create a less ugly website yourself. The world of front-end development is complex and tedious, and the combination of Vue and Bulma may be the solution. I personally find both easy to use. The Bulma UI looks great, the community is great, and if you encounter any issues, you can search and find help. The following tutorial shows how to use Bulma in a new Vue3 project.
1. Create a Vue3 application
npm init vue@latest
This command will install and execute create-vue, the official Vue project scaffolding tool. You'll see some optional features:
✔ Project name: …
Scaffolding project in ./
This is a learning project, so select yes to all the options.
After the project is created, follow these steps to install dependencies and start the development server:
cd
With these simple steps, you have your first Vue 3 project up and running.
2. Install Bulma
- Install Bulma dependencies
npm install --save-dev node-sass sass-loader
- Install Bulma
npm install bulma
3. Import Bulma into the Vue3 project
- In src/assets/main.css, add the following:
/* Bulma Import */ @import 'bulma/css/bulma.css';
- In src/main.ts, make sure to import the main.css file. If you created the project using the instructions in the previous article, it should be included by default.
import { createApp } from "vue";
import { createPinia } from "pinia";
import App from "./App.vue";
import router from "./router";
import "./assets/main.css";
const app = createApp(App);
app.use(createPinia());
app.use(router);
app.mount("#app");
Note: This is the line
import "./assets/main.css";
4. Create a button validation in the about route
Add the bulma button test to src/views/AboutView.vue as follows:
This is an about page
Open http://localhost:5173/about in your browser. As shown in the figure, the various colored buttons display normally, indicating that Bulma has been successfully used.
This is not a professional front-end developer, so please feel free to correct any errors.
Copyright statement:
- All content that is not sourced is original., please do not reprint without authorization (because the typesetting is often disordered after reprinting, the content is uncontrollable, and cannot be continuously updated, etc.);
- For non-profit purposes, to deduce any content of this blog, please give the relevant webpage address of this site in the form of 'source of original text' or 'reference link' (for the convenience of readers).