0.0.142 • Published 1 year ago

akvts v0.0.142

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

Akvts UI

安装

npm isntall akvts --save-dev

vite.config.js 配置

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import pages from 'vite-plugin-pages'
import path from 'path'
import UnoCSS from 'unocss/vite' // 必要配置
import presetIcons from '@unocss/preset-icons' // 必要配置
import ElementPlus from 'unplugin-element-plus/vite'

export default defineConfig({
  resolve: {
    alias: {
      '@': path.resolve(\_\_dirname, './src'),
    },
  },
	css: {
		preprocessorOptions: {
			scss: {
				// 必要配置
				additionalData: `
					@use 'akvts/src/styles/lib/_mixin.scss' as *;
				`,
			},
		},
	},
  plugins: [
    vue(),
    // UnoCss 必要配置
    UnoCSS({
      presets: [
      presetIcons(),
      ],
      content: {
				pipeline: {
					include: [
						// 默认扫描 src 目录
						/\.js$/, // 扫描 .js 文件, 必要配置
						/\.vue$/, // 扫描 .vue 文件
					],
				},
				},
    }),
    ElementPlus({
      useSource: true,
    }),
    pages({
      dirs: 'src/views',
      exclude: ['**/components/*.vue'],
    }),
  ],
})

main.js 配置

import {createApp} from 'vue'
import {createPinia} from 'pinia' // 引入Pinia
import './api/axios' // 引入全局axios配置
import App from './App.vue'
import router from './router'
import akvts from 'akvts' // 引入 akvts
import 'virtual:uno.css' // 引入 uno.css

const app = createApp(App)
const pinia = createPinia()

async function initApp() {
	const [ElementPlus, zhCn, ElementPlusIconsVue, Directive] = await Promise.all([
		import('element-plus'),
		import('element-plus/dist/locale/zh-cn.mjs'),
		import('@element-plus/icons-vue'),
		import('akvts/src/directive'), // 引入框架指令, 框架组件内部使用了一些指令
		import('akvts/src/styles/main.scss'), // 引入框架全局样式
		import('akvts/dist/style.css'), // 引入组件样式
	])

	app.use(ElementPlus, {
		locale: zhCn.default,
	})

	for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
		app.component(key, component)
	}

	Directive.directives(app) // 使用框架指令
	app.use(pinia)
	app.use(router)
	app.use(akvts) // 使用框架
	app.mount('#app')

	document.title = import.meta.env.VITE_TITLE
}

initApp()

axios.js 配置

import axios from 'axios'

// 通过 .env配置全局接口, 也可以自行配置公共接口文件, 但要保证baseURL的配置, 因为组件内部会使用 axios
axios.defaults.baseURL = import.meta.env.VITE_GLOBAL_API_URL
axios.defaults.headers['Content-Type'] = 'application/json'
axios.defaults.timeout = Number(import.meta.env.VITE_PORT) * 1000 // 通过 .env 超时

axios.interceptors.request.use((config) => {
	return config
})

axios.interceptors.response.use(
	(response) => {
		return response
	},
	(error) => {
		return Promise.reject(error)
	}
)

export default axios
0.0.106

1 year ago

0.0.105

1 year ago

0.0.104

1 year ago

0.0.103

1 year ago

0.0.109

1 year ago

0.0.108

1 year ago

0.0.107

1 year ago

0.0.102

1 year ago

0.0.117

1 year ago

0.0.116

1 year ago

0.0.115

1 year ago

0.0.114

1 year ago

0.0.119

1 year ago

0.0.118

1 year ago

0.0.113

1 year ago

0.0.112

1 year ago

0.0.111

1 year ago

0.0.110

1 year ago

0.0.128

1 year ago

0.0.127

1 year ago

0.0.126

1 year ago

0.0.125

1 year ago

0.0.129

1 year ago

0.0.120

1 year ago

0.0.124

1 year ago

0.0.123

1 year ago

0.0.122

1 year ago

0.0.121

1 year ago

0.0.139

1 year ago

0.0.137

1 year ago

0.0.136

1 year ago

0.0.131

1 year ago

0.0.130

1 year ago

0.0.135

1 year ago

0.0.134

1 year ago

0.0.133

1 year ago

0.0.132

1 year ago

0.0.142

1 year ago

0.0.101

1 year ago

0.0.100

1 year ago

0.0.99

1 year ago

0.0.98

1 year ago

0.0.97

1 year ago

0.0.96

1 year ago

0.0.95

1 year ago

0.0.94

1 year ago

0.0.93

1 year ago

0.0.92

1 year ago

0.0.91

1 year ago

0.0.90

1 year ago

0.0.89

1 year ago

0.0.88

1 year ago

0.0.87

1 year ago

0.0.86

1 year ago

0.0.85

1 year ago

0.0.84

1 year ago

0.0.83

1 year ago

0.0.82

1 year ago

0.0.81

1 year ago

0.0.80

1 year ago

0.0.79

1 year ago

0.0.78

1 year ago

0.0.77

1 year ago

0.0.76

1 year ago

0.0.75

1 year ago

0.0.74

1 year ago

0.0.73

1 year ago

0.0.72

1 year ago

0.0.71

1 year ago

0.0.70

1 year ago

0.0.69

1 year ago

0.0.68

1 year ago

0.0.67

1 year ago

0.0.66

1 year ago

0.0.65

1 year ago

0.0.64

1 year ago

0.0.63

1 year ago

0.0.62

1 year ago

0.0.61

1 year ago

0.0.60

1 year ago

0.0.59

1 year ago

0.0.58

1 year ago

0.0.57

1 year ago

0.0.56

1 year ago

0.0.55

1 year ago

0.0.54

1 year ago

0.0.53

1 year ago

0.0.52

1 year ago

0.0.51

1 year ago

0.0.50

1 year ago

0.0.49

1 year ago

0.0.48

1 year ago

0.0.47

1 year ago

0.0.46

1 year ago

0.0.45

1 year ago

0.0.44

1 year ago

0.0.43

1 year ago

0.0.42

1 year ago

0.0.41

1 year ago

0.0.40

1 year ago

0.0.39

1 year ago

0.0.38

1 year ago

0.0.37

1 year ago

0.0.36

1 year ago

0.0.35

1 year ago

0.0.34

1 year ago

0.0.33

1 year ago

0.0.32

1 year ago

0.0.31

1 year ago

0.0.30

1 year ago

0.0.29

1 year ago

0.0.28

1 year ago

0.0.27

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.20

1 year ago

0.0.19

1 year ago

0.0.18

1 year ago

0.0.17

1 year ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago

0.0.0

1 year ago