更新记录
0.0.2(2025-06-18)
新增css样式
0.0.1(2025-06-18)
1、新增组件JView 2、新增组件JText 3、新增组件JIcon
平台兼容性
云端兼容性
阿里云 | 腾讯云 | 支付宝云 |
---|---|---|
√ | √ | √ |
uni-app(4.71)
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | √ | √ | √ | - | √ | √ | √ |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
√ | - | - | - | - | - | - | - | - | - | - |
uni-app x(4.71)
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
√ | √ | √ | √ | √ | √ |
其他
多语言 | 暗黑模式 | 宽屏模式 |
---|---|---|
√ | √ | √ |
使用
1、安装组件
在应用市场点击右上侧购买或者试用安装。
2、引入全局样式变量
在 uni.scss
中配置:
@import '@/uni_modules/jiu-uni/themes/vars.scss';
样式变量清单(可在 uni.scss
中覆盖):
// 颜色
$j-color-light: rgba(255, 255, 255, 1);
$j-color-dark: rgba(8, 14, 26, 1);
$j-color: (
'primary': rgba(26, 92, 255, 1),
'success': rgba(70, 201, 58, 1),
'warning': rgba(255, 186, 0, 1),
'danger': rgba(255, 71, 87, 1),
'info': rgba(178, 178, 178, 1)
);
// 尺寸
$j-size-base: 16;
$j-size-font: (
'xs': $j-size-base * 0.625,
'sm': $j-size-base * 0.75,
'md': $j-size-base * 1,
'lg': $j-size-base * 1.125,
'xl': $j-size-base * 1.5
);
$j-size-space: (
'xs': $j-size-base * 0.25,
'sm': $j-size-base * 0.5,
'md': $j-size-base * 1,
'lg': $j-size-base * 1.5,
'xl': $j-size-base * 3
);
// 阴影
$j-shadow: (
'xs': (
'light': 0 1px 2px 0 rgba($j-color-dark, 0.1),
'dark': 0 1px 2px 0 rgba($j-color-light, 0.1)
),
'sm': (
'light': '0 1px 3px 0 rgba($j-color-dark, 0.1), 0 1px 2px -1px rgba($j-color-dark, 0.1)',
'dark': '0 1px 3px 0 rgba($j-color-light, 0.1), 0 1px 2px -1px rgba($j-color-light, 0.1)'
),
'md': (
'light': '0 4px 6px -1px rgba($j-color-dark, 0.1), 0 2px 4px -2px rgba($j-color-dark, 0.1)',
'dark': '0 4px 6px -1px rgba($j-color-light, 0.1), 0 2px 4px -2px rgba($j-color-light, 0.1)'
),
'lg': (
'light': '0 10px 15px -3px rgba($j-color-dark, 0.1), 0 4px 6px -4px rgba($j-color-dark, 0.1)',
'dark': '0 10px 15px -3px rgba($j-color-light, 0.1), 0 4px 6px -4px rgba($j-color-light, 0.1)'
),
'xl': (
'light': '0 20px 25px -5px rgba($j-color-dark, 0.1), 0 8px 10px -6px rgba($j-color-dark, 0.1)',
'dark': '0 20px 25px -5px rgba($j-color-light, 0.1), 0 8px 10px -6px rgba($j-color-light, 0.1)'
)
);
// 字体
$j-font-size: $j-size-base + px;
$j-font-line: 1.4;
$j-font-color-light: rgba(44, 62, 80, 1);
$j-font-color-dark: rgba(228, 243, 234, 1);
$j-font-family: monospace, sans-serif, serif, fantasy;
3、引入全局样式
在 App.vue
中配置:
@import '@/uni_modules/jiu-uni/themes/index.scss';
4、组件安装
4.1、全局安装
vue2 安装:
在 uni-app
环境下 vue2
不支持 Vue.use()
只能通过 easycom 方式安装
vue3 安装:
import { createSSRApp } from 'vue';
import jiuUni from '@/uni_modules/jiu-uni/index.uts';
import App from './App';
export function createApp() {
const app = createSSRApp(App);
app.use(jiuUni);
return { app };
};
4.2、easycom 安装
在 pages.json
中配置:
vue2 安装:
{
"easycom": {
"autoscan": true,
"custom": {
"^j-(.*)": "uni_modules/jiu-uni/components/$1/$1.vue"
}
}
}
vue3 安装:
{
"easycom": {
"autoscan": true,
"custom": {
"^j-(.*)": "uni_modules/jiu-uni/components/$1/$1.uvue"
}
}
}
5、暗色主题
暗色主题跟随系统主题,默认不开启暗色主题适配。
开启暗色适配,在 main(.uts/.ts/.js)
中增加:
5.1、全局配置:
vue2:
import Vue from 'vue';
import { JiuUni } from '@/uni_modules/jiu-uni/index.uts';
import App from './App';
Vue.use(JiuUni, { JDark: true }); // 开启暗色适配(此处只能开启暗色适配,不能注册组件)
const app = new Vue({ ...App });
app.$mount();
vue3:
import { createSSRApp } from 'vue';
import { JiuUni } from '@/uni_modules/jiu-uni/index.uts';
import App from './App';
export function createApp() {
const app = createSSRApp(App);
app.use(JiuUni, { JDark: true }); // 开启暗色适配
return { app };
};
5.2、easycom 独立配置:
vue2:
import Vue from 'vue';
import App from './App';
Vue.prototype.$JDark = true; // 开启暗色适配
const app = new Vue({ ...App });
app.$mount();
vue3:
import { createSSRApp } from 'vue';
import App from './App';
export function createApp() {
const app = createSSRApp(App);
app.provide('JDark', true); // 开启暗色适配
return { app };
};
5.3、获取当前主题值:
import { useConfig } from '@/uni_modules/jiu-uni/index.uts';
const config = useConfig();
console.log(config.isDark.value);
6、多语言环境
初始化未设定语言时,当前语言默认为系统语言。
默认初始化设定语言,在 main(.uts/.ts/.js)
中增加:
6.1、全局初始化语言:
vue2:
import Vue from 'vue';
import { JiuUni } from '@/uni_modules/jiu-uni/index.uts';
import App from './App';
Vue.use(JiuUni, { JLocal: 'en' }); // 初始化语言(此处只能初始化语言,不能注册组件)
const app = new Vue({ ...App });
app.$mount();
vue3:
import { createSSRApp } from 'vue';
import { JiuUni } from '@/uni_modules/jiu-uni/index.uts';
import App from './App';
export function createApp() {
const app = createSSRApp(App);
app.use(JiuUni, { JLocal: 'en' }); // 初始化语言
return { app };
};
6.2、获取当前语言值:
import { useConfig } from '@/uni_modules/jiu-uni/index.uts';
const config = useConfig();
console.log(config.local.value);
6.3、设置当前语言值:
import { useConfig } from '@/uni_modules/jiu-uni/index.uts';
const config = useConfig();
config.setLocal('en'); // en、zh-Hans、zh-Hant、fr、es
样式
flex 样式
样式名 | 说明 |
---|---|
flex | display: flex; |
flex-auto | flex: 1 1 auto; |
flex-initial | flex: 0 1 auto; |
flex-none | flex: none; |
flex-[x] | flex: [x]; (x支持1~12) |
flex-row | flex-direction: row; |
flex-row-reverse | flex-direction: row-reverse; |
flex-col | flex-direction: column; flex-wrap: nowrap; |
flex-col-reverse | flex-direction: column-reverse; flex-wrap: nowrap; |
flex-nowrap | flex-wrap: nowrap; |
flex-wrap | flex-wrap: wrap; |
flex-wrap-reverse | flex-wrap: wrap-reverse; |
justify-start | justify-content: flex-start; |
justify-end | justify-content: flex-end; |
justify-center | justify-content: center; |
justify-between | justify-content: space-between; |
justify-around | justify-content: space-around; |
justify-evenly | justify-content: space-evenly; |
content-center | align-content: center; |
content-start | align-content: flex-start; |
content-end | align-content: flex-end; |
content-between | align-content: space-between; |
content-around | align-content: space-around; |
content-stretch | align-content: stretch; |
items-start | align-items: flex-start; |
items-end | align-items: flex-end; |
items-center | align-items: center; |
items-stretch | align-items: stretch; |
self-auto | align-self: auto; |
self-start | align-self: flex-start; |
self-end | align-self: flex-end; |
self-center | align-self: center; |
self-stretch | align-self: stretch; |
font 样式
样式名 | 说明 |
---|---|
font-[xs|sm|md|lg|xl] | $j-size-font 对应值 |
italic | font-style: italic; |
not-italic | font-style: normal; |
font-bold | font-weight: bold; |
font-normal | font-weight: normal; |
font-400 | font-weight: 400; |
font-700 | font-weight: 700; |
text-left | text-align: left; |
text-center | text-align: center; |
text-right | text-align: right; |
truncate | overflow: hidden; text-overflow: ellipsis; white-space: nowrap; |
text-ellipsis | text-overflow: ellipsis; |
text-clip | text-overflow: clip; |
underline | text-decoration-line: underline; |
line-through | text-decoration-line: line-through; |
size 样式
样式名 | 说明 |
---|---|
fit | width: 100%; height: 100%; |
full-height | height: 100%; |
full-width | width: 100%; |
box-border | box-sizing: border-box; |
box-content | box-sizing: content-box; |
overflow | overflow: hidden; |
place 样式
样式名 | 说明 |
---|---|
fixed | position: fixed; |
absolute | position: absolute; |
relative | position: relative; |
space 样式
样式名 | 说明 |
---|---|
p | md 大小内边距 |
p-[xs|sm|md|lg|xl] | $j-size-space 对应值 |
p-[l|r|lr|x|t|b|tb|y] | l:左边距,r:右边距,lr | x:左右边距,t:上边距,b:下边距,tb | y:上下边距 |
p-[l|r|lr|x|t|b|tb|y]-[xs|sm|md|lg|xl] | $j-size-space 对应值,l:左边距,r:右边距,lr | x:左右边距,t:上边距,b:下边距,tb | y:上下边距 |
m | md 大小外边距 |
m-[xs|sm|md|lg|xl] | $j-size-space 对应值 |
m-[l|r|lr|x|t|b|tb|y] | l:左边距,r:右边距,lr | x:左右边距,t:上边距,b:下边距,tb | y:上下边距 |
m-[l|r|lr|x|t|b|tb|y]-[xs|sm|md|lg|xl] | $j-size-space 对应值,l:左边距,r:右边距,lr | x:左右边距,t:上边距,b:下边距,tb | y:上下边距 |
border 样式
样式名 | 说明 |
---|---|
border | border-width: 1px; |
border-[l|r|lr|x|t|b|tb|y] | 边框1px,l:左边框,r:右边框,lr | x:左右边框,t:上边框,b:下边框,tb | y:上下边框 |
border-[x] | border-width: [x]px; (x支持1~12) |
border-[l|r|lr|x|t|b|tb|y]-[x] | 边框[x]px,l:左边框,r:右边框,lr | x:左右边框,t:上边框,b:下边框,tb | y:上下边框 |
rounded-[xs|sm|md|lg|xl] | $j-size-space-x 对应值 |
rounded-[lt|lb|rt|rb]-[xs|sm|md|lg|xl] | lt:左上角,lb:左下角,rt:右上角,rb:右下角 |
rounded-none | border-radius: 0; |
rounded-[lt|lb|rt|rb]-[xs|sm|md|lg|xl]-none | lt:左上角,lb:左下角,rt:右上角,rb:右下角 |
border-solid | border-style: solid; |
border-dashed | border-style: dashed; |
border-dotted | border-style: dotted; |
border-none | border-style: none; |
shadow-[xs|sm|md|lg|xl] | $j-shadow 对应值 |
color 样式
样式名 | 说明 |
---|---|
text-primary | 字体颜色,$j-color 对应值 |
text-success | 字体颜色,$j-color 对应值 |
text-warning | 字体颜色,$j-color 对应值 |
text-danger | 字体颜色,$j-color 对应值 |
text-info | 字体颜色,$j-color 对应值 |
bg-primary | 背景颜色,$j-color 对应值 |
bg-success | 背景颜色,$j-color 对应值 |
bg-warning | 背景颜色,$j-color 对应值 |
bg-danger | 背景颜色,$j-color 对应值 |
bg-info | 背景颜色,$j-color 对应值 |
组件
JView View组件
属性
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
hoverClass | String | none | 指定按下去的样式类 |
hoverStopPropagation | Boolean | false | 指定是否阻止本节点的祖先节点出现点击态 |
hoverStartTime | Number | 50 | 按住后多久出现点击态,单位毫秒 |
hoverStayTime | Number | 400 | 手指松开后点击态保留时间,单位毫秒 |
插槽
插槽名称 | 说明 |
---|---|
default | 默认插槽 |
事件
事件名 | 参数 | 说明 |
---|---|---|
ready | (el: UniElement | null) | 初始化完成事件,uni-app x 获取 UniElement 对象 |
JText Text组件
属性
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
selectable | Boolean | false | 文本是否可选 |
space | String | - | 显示连续空格 |
decode | Boolean | false | 是否解码 |
userSelect | Boolean | false | 文本是否可选 |
size | Number, String | 16 | 字体大小 |
unit | String | px | 字体大小单位,可选值:rpx、px |
color | String | - | 字体颜色 |
align | String | - | 文本对齐方式,可选值:left、center、right |
decoration | String | - | 文本的修饰,可选值:none、 underline、line-through |
bold | Boolean | false | 是否加粗 |
插槽
插槽名称 | 说明 |
---|---|
default | 默认插槽 |
事件
事件名 | 参数 | 说明 |
---|---|---|
ready | (el: UniElement | null) | 初始化完成事件,uni-app x 获取 UniElement 对象 |
JIcon 图标组件
属性
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
type | String | - | 图标类型 |
size | [String, Number] | 16 | 图标大小 |
family | String | iconfont | 图标字体 |
unit | String | px | 图标尺寸单位 |
color | String | - | 图标颜色 |
spin | Boolean | false | 图标是否旋转 |
duration | Number | 1500 | 图标旋转动画时间 |
rotation | Number | 0 | 图标旋转角度 |
插槽
插槽名称 | 说明 |
---|
事件
事件名 | 参数 | 说明 |
---|