mirror of
https://github.com/ialley-workshop-open/uni-halo.git
synced 2026-06-11 12:49:30 +08:00
feat: 添加插件检测
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* 功能:插件检查
|
||||
*/
|
||||
import {
|
||||
NeedPluginIds,
|
||||
NeedPlugins,
|
||||
checkNeedPluginAvailable
|
||||
} from "@/utils/plugin.js"
|
||||
import PluginUnavailable from '@/components/plugin-unavailable/plugin-unavailable.vue'
|
||||
|
||||
|
||||
const HaloPluginAvailableMixin = {
|
||||
components: {
|
||||
PluginUnavailable
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
NeedPluginIds,
|
||||
NeedPlugins,
|
||||
uniHaloPluginAvailableError: "",
|
||||
uniHaloPluginAvailable: true,
|
||||
uniHaloPluginId: "", // 当前需要的插件
|
||||
uniHaloPluginInfo: "" // 当前插件信息
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
/** 设置插件ID */
|
||||
setPluginId(pluginId) {
|
||||
this.uniHaloPluginId = pluginId
|
||||
this.uniHaloPluginInfo = NeedPlugins.get(pluginId)
|
||||
},
|
||||
/** 检查插件状态 */
|
||||
async checkPluginAvailable(pluginId) {
|
||||
pluginId = pluginId ?? this.uniHaloPluginId
|
||||
if (!pluginId) return false;
|
||||
const available = await checkNeedPluginAvailable(pluginId)
|
||||
this.uniHaloPluginAvailable = available
|
||||
return available
|
||||
},
|
||||
/** 设置错误信息 */
|
||||
setPluginError(text) {
|
||||
this.uniHaloPluginAvailableError = text
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export default HaloPluginAvailableMixin;
|
||||
@@ -172,3 +172,170 @@
|
||||
}
|
||||
|
||||
/* 文本省略样式 结束 */
|
||||
|
||||
|
||||
// 定义尺寸变量(单位:rpx)
|
||||
$spacing-sizes: (
|
||||
0: 0,
|
||||
2: 4rpx,
|
||||
4: 8rpx,
|
||||
8: 16rpx,
|
||||
12: 24rpx,
|
||||
24: 48rpx,
|
||||
48: 96rpx
|
||||
);
|
||||
|
||||
// 内边距类
|
||||
@each $name, $size in $spacing-sizes {
|
||||
// 全方向内边距:p-{size}
|
||||
.p-#{$name} {
|
||||
padding: $size !important;
|
||||
}
|
||||
|
||||
// 水平方向内边距:px-{size}
|
||||
.px-#{$name} {
|
||||
padding-left: $size !important;
|
||||
padding-right: $size !important;
|
||||
}
|
||||
|
||||
// 垂直方向内边距:py-{size}
|
||||
.py-#{$name} {
|
||||
padding-top: $size !important;
|
||||
padding-bottom: $size !important;
|
||||
}
|
||||
|
||||
// 上内边距:pt-{size}
|
||||
.pt-#{$name} {
|
||||
padding-top: $size !important;
|
||||
}
|
||||
|
||||
// 右内边距:pr-{size}
|
||||
.pr-#{$name} {
|
||||
padding-right: $size !important;
|
||||
}
|
||||
|
||||
// 下内边距:pb-{size}
|
||||
.pb-#{$name} {
|
||||
padding-bottom: $size !important;
|
||||
}
|
||||
|
||||
// 左内边距:pl-{size}
|
||||
.pl-#{$name} {
|
||||
padding-left: $size !important;
|
||||
}
|
||||
}
|
||||
|
||||
//外边距工具类
|
||||
@each $name, $size in $spacing-sizes {
|
||||
// 全方向外边距:m-{size}
|
||||
.m-#{$name} {
|
||||
margin: $size !important;
|
||||
}
|
||||
|
||||
// 水平方向外边距:mx-{size}
|
||||
.mx-#{$name} {
|
||||
margin-left: $size !important;
|
||||
margin-right: $size !important;
|
||||
}
|
||||
|
||||
// 垂直方向外边距:my-{size}
|
||||
.my-#{$name} {
|
||||
margin-top: $size !important;
|
||||
margin-bottom: $size !important;
|
||||
}
|
||||
|
||||
// 上外边距:mt-{size}
|
||||
.mt-#{$name} {
|
||||
margin-top: $size !important;
|
||||
}
|
||||
|
||||
// 右外边距:mr-{size}
|
||||
.mr-#{$name} {
|
||||
margin-right: $size !important;
|
||||
}
|
||||
|
||||
// 下外边距:mb-{size}
|
||||
.mb-#{$name} {
|
||||
margin-bottom: $size !important;
|
||||
}
|
||||
|
||||
// 左外边距:ml-{size}
|
||||
.ml-#{$name} {
|
||||
margin-left: $size !important;
|
||||
}
|
||||
}
|
||||
|
||||
// gap 类
|
||||
@each $name, $size in $spacing-sizes {
|
||||
// 全方向gap:gap-{size}
|
||||
.gap-#{$name} {
|
||||
gap: $size !important;
|
||||
}
|
||||
|
||||
// 水平方向gap:gap-x-{size}
|
||||
.gap-x-#{$name} {
|
||||
column-gap: $size !important;
|
||||
}
|
||||
|
||||
// 垂直方向gap:gap-y-{size}
|
||||
.gap-y-#{$name} {
|
||||
row-gap: $size !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.w-full {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.h-full {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-col {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.flex-1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.flex-shrink-0 {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.items-center {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.items-start {
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.items-end {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.justify-between {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.justify-around {
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.justify-end {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.justify-start {
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
.justify-center {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user