Layui Vue是一套Vue 3.0桌面组件库,遵循Layuivue经典的设计规范,开箱即用。2022年Layui Vue发布了1.0版本,2023年发布了基于Vue 3的2.0版本。它是一个UI组件库,使用简单,稳定可靠,设计经典。
使用npm工具安装layui vue
npm install @layui/layui-vue --save
全局注册到 Vue
import App from './App.vue'
import { createApp } from 'vue'
import Layui from '@layui/layui-vue'
import '@layui/layui-vue/lib/index.css' // 样式需要单独引入
createApp(App).use(Layui).mount('#app')
按需引入
import App from './App.vue'
import { createApp } from 'vue'
import { LayButton, LayTable } from '@layui/layui-vue'
import '@layui/layui-vue/es/button/index.css';
import '@layui/layui-vue/es/table/index.css';
var app = createApp(App).
app.component("LayButton", LayButton);
app.component("LayTable", LayTable);
app.mount('#app')
Layui – Vue直接引入
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="//unpkg.com/@layui/layui-vue/lib/index.css" />
<script src="//unpkg.com/vue@3"></script>
<script src="//unpkg.com/@layui/layui-vue"></script>
</head>
<body>
<div id="app">
<lay-button type="primary">{{ message }}</lay-button>
</div>
<script>
const App = {
data() {
return {
message: "Hello World"
};
},
};
const app = Vue.createApp(App);
app.use(LayuiVue);
app.mount("#app");
</script>
</body>
</html>
进入Layui Vue中文文档
以上是编程学习网小编为您介绍的“Layui - Vue 前端UI框架的调用”的全面内容,想了解更多关于 vuejs 内容,请继续关注编程基础学习网。
织梦狗教程
本文标题为:Layui - Vue 前端UI框架的调用


基础教程推荐
猜你喜欢
- css实现元素垂直居中显示的7种方式 2023-12-30
- vue3+ts+elementPLus实现v-preview指令 2023-07-09
- 原生JS实现H5转盘游戏的示例代码 2024-02-04
- 非常简单的Ajax请求实例附源码 2022-10-17
- css利用linear-gradient设置渐变色 2024-12-13
- android WebView加载html5介绍 2023-12-20
- 块元素block element和内联元素inline element 2022-10-16
- 清除浮动的几种方法(推荐) 2024-01-23
- 解决鼠标在 flash 链接上不停闪动的问题(web页面中) 2022-11-06
- JS判断当前页面是否在微信浏览器打开的方法 2023-12-18