代码拉取完成,页面将自动刷新
<title>routerboot-ui: 1.0.3</title>routerboot-uirouterboot-ui1.0.31.0.3<script xmlns=""/>
版本(version) | 1.0.3 |
---|---|
版本说明(version tag) | 正式版 |
更新时间(update date) | 20230405 |
技术(technology) | Vue3+TS+SCSS+Vite |
可用版本(work version):
更新点(update points):
npm i routerboot-ui
在main.ts
下导入(import in main.ts
)
import { createApp } from "vue";
import App from "./App.vue";
//import routerboot-ui
import RouterBootUI from "routerboot-ui";
//import routerboot-ui style file
import "routerboot-ui/packages/theme-chalk/index.scss";
//create app--------------------
const app = createApp(App);
//app use--------------------
app.use(RouterBootUI);
app.mount("#app");
<template>
<div id="index">
<RBIcon icon="rb-icon-hezuo"></RBIcon>
<RBIcon icon="rb-icon-exchange"></RBIcon>
<RBButton>test</RBButton>
</div>
</template>
MIT
我们当前支持'primary,success,info,warning,error,dark'
这6种系统内置主题,所有组件默认采用primary
黑暗主题色,但使用者也可以直接使用type属性直接进行指定
如下,我们在按钮组件中使用type属性指定主题为dark
主题
<RBButton type="dark">test</RBButton>
由于内置6种主题色,我们可以使用一个变量绑定主题,通过修改变量方式进行切换主题色,实现动态主题
<RBButton :type="theme" @click="store.changeTheme()">点一下试试</RBButton>
<script lang="ts" setup>
import { ref, reactive, computed } from 'vue'
import { indexStore } from './store/indexPinia'
const store = indexStore()
let theme = computed(() => {
return store.theme[store.current]
})
</script>
import { defineStore } from "pinia";
export const indexStore = defineStore("index", {
state: () => {
return {
current: 0,
theme: ["primary", "info", "success", "warning", "error", "dark"],
};
},
actions: {
changeTheme() {
console.log(this.current);
if (this.current == 5) {
this.current = 0;
} else {
this.current++;
}
},
},
});
编写一个global.scss,然后导入main.ts
注意:当前自定义主题色仍存在一定问题
/* 只需要重写你需要的即可 */
@forward 'routerboot-ui/packages/theme-chalk/src/common/var.scss' with (
$colors: (
'white': #ffffff,
'black': #000000,
'primary': #2a6f94,
'success': #97cd47,
'warning': #f8805d,
'error': #ec5e65,
'info': #788a93,
'dark':#21282c,
),
);
@use "routerboot-ui/packages/theme-chalk/index.scss" as *;
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。