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
---
相关推荐
是千千千熠啊3 小时前
vue使用Fabric和pdfjs完成合同签章及批注
前端·vue.js
九月TTS3 小时前
TTS-Web-Vue系列:组件逻辑分离与模块化重构
前端·vue.js·重构
满怀10155 小时前
【Vue 3全栈实战】从响应式原理到企业级架构设计
前端·javascript·vue.js·vue
梅子酱~5 小时前
Vue 学习随笔系列二十三 -- el-date-picker 组件
前端·vue.js·学习
源码云商7 小时前
【带文档】网上点餐系统 springboot + vue 全栈项目实战(源码+数据库+万字说明文档)
数据库·vue.js·spring boot
魔术师ID7 小时前
vue 指令
前端·javascript·vue.js
smileNicky9 小时前
在 VSCode 中运行 Vue.js 项目
ide·vue.js·vscode
程序员小远10 小时前
UI自动化测试方案详解
自动化测试·软件测试·selenium·测试工具·ui·职场和发展·测试用例
小马哥编程10 小时前
React和Vue在前端开发中, 通常选择哪一个
前端·vue.js·react.js
HCl+NaOH=NaCl+H_2O11 小时前
Quasar组件 Carousel走马灯
javascript·vue.js·ecmascript