UI -- Vue3

Vue3 模板

Vue3 UI

  • package.json同级
  • components/slButton/element.vue
js 复制代码
<template>
    <div class="dddiv"><span>测试321</span></div>
</template>

<script setup>
    defineOptions({
    name: "sl-button"
});
</script>

<style scoped>
    .dddiv span{
    color: red;
}
</style>  
  • components/slButton/index.js
js 复制代码
import element from "./element.vue";
element.install = (app) => app.component(element.name, element);
export default element;
  • components/function.js
js 复制代码
export const ceshi = ()=>{
    console.log('123')
}
  • components/index.js
js 复制代码
import slButton from "./slButton/index"
import {ceshi} from "./function"

const components = [slButton];

const install = (app, opts = {}) => {
    components.forEach((component) => {
        app.use(component);
    });
    app.config.globalProperties.$ceshi = ceshi;
};

const Sl = {
    install,
    slButton
};

export { slButton, install };
export default Sl;

使用

  • main.js
js 复制代码
import Sl from '../components/index'
// 打包使用需要引入css
createApp(App).use(SL).mount('#app');


<sl-button></sl-button>

import { getCurrentInstance } from "vue";
const { appContext } = getCurrentInstance();
appContext.config.globalProperties.$ceshi();

UI 文档

bash 复制代码
npm i vitepress -D
  • package.json
json 复制代码
"scripts": {
    "docs:dev": "vitepress dev docs",
    "docs:build": "vitepress build docs",
    "docs:serve": "vitepress serve docs"
  }
  • package.json 同级
  • docs 创建

docs 目录结构

.vitepress

  • theme/index.js
js 复制代码
import DefaultTheme from "vitepress/theme";
import Sll from "../../../components/index";
// 引入打包之后的需要css

export default {
    ...DefaultTheme,
    enhanceApp: async ({ app }) => {
        app.use(Sll);
    },
};

component

md 复制代码
# button


<ClientOnly>
<sl-button></sl-button>
</ClientOnly>

::: details 显示代码

\```html
<sl-button></sl-button>
\```

:::

get-started

md 复制代码
---
title: 快速上手
---

## 安装

请参考 [安装](../install/) 章节


## 单个引入
 
## 全局引入
 

guid

md 复制代码
---
title: UI
---

# UI


 

👀 介绍

- 本 UI 框架是基于 Vue3 实现的。

📌 项目特点

- UI

🔮 视觉稿

- UI

🚲 为什么叫   UI

- UI

install

md 复制代码
---
title: 安装
---

# 安装

推荐安装  xxx@版本

\```bash
npm install xxx@版本
\```

或

\```bash
yarn add xxx@版本
\```

index.md

md 复制代码
---
layout: home


features:
- title: 简易好学
  icon: ⚡
  details: 基于 VUE3
- title: Vue 驱动
  icon: 🖖
  details: 享受 Vue 的开发体验,实践最流行的技术。
- title: s-ui
  icon: 🛠️
  details: s-ui
---
相关推荐
王王碎冰冰8 小时前
基于 Vue3@3.5+跟Ant Design of Vue 的二次封装的 Form跟搜索Table
前端·vue.js
天蓝色的鱼鱼9 小时前
Element UI 2.X 主题定制完整指南:解决官方工具失效的实战方案
前端·vue.js
我是日安10 小时前
从零到一打造 Vue3 响应式系统 Day 8 - Effect:深入剖析嵌套 effect
前端·vue.js
DevUI团队10 小时前
🚀 MateChat V1.8.0 震撼发布!对话卡片可视化升级,对话体验全面进化~
前端·vue.js·人工智能
好好好明天会更好10 小时前
pinia从定义到运用
前端·vue.js
代码小学僧10 小时前
Vite 项目最简单方法解决部署后 Failed to fetch dynamically imported Error问题
前端·vue.js·vite
东坡白菜11 小时前
SSE 实现 AI 对话中的流式输出
javascript·vue.js
猩兵哥哥14 小时前
前端面向对象设计原则运用 - 策略模式
前端·javascript·vue.js
EMT16 小时前
在 Vue 项目中使用 URL Query 保存和恢复搜索条件
javascript·vue.js
我是日安16 小时前
从零到一打造 Vue3 响应式系统 Day 9 - Effect:调度器实现与应用
前端·vue.js