2021-03-04 18:18:26 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="awesome-container">
|
|
|
|
|
<el-card shadow="hover" :header="`fontawesome 字体图标(自动载入):${sheetsIconList.length - 24}个`">
|
|
|
|
|
<el-row class="iconfont-row">
|
|
|
|
|
<template v-for="(v,k) in sheetsIconList" :key="k">
|
|
|
|
|
<el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="2">
|
|
|
|
|
<div class="iconfont-warp">
|
|
|
|
|
<div class="flex-margin">
|
|
|
|
|
<div class="iconfont-warp-value">
|
|
|
|
|
<i :class="v" class="fa"></i>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="iconfont-warp-label mt10">{{v}}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</template>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-03-04 21:57:25 +08:00
|
|
|
|
import { toRefs, reactive, onMounted } from "vue";
|
|
|
|
|
import initIconfont from "/@/utils/getStyleSheets.ts";
|
2021-03-04 18:18:26 +08:00
|
|
|
|
export default {
|
|
|
|
|
name: "awesome",
|
|
|
|
|
setup() {
|
|
|
|
|
const state = reactive({
|
|
|
|
|
sheetsIconList: [],
|
|
|
|
|
});
|
2021-03-04 21:57:25 +08:00
|
|
|
|
// 初始化获取 css 样式,这里使用fontawesome的图标(记得加上前缀 `fa`),其它第三方请自行做判断
|
2021-03-04 18:18:26 +08:00
|
|
|
|
const initGetStyleSheets = () => {
|
2021-03-04 21:57:25 +08:00
|
|
|
|
initIconfont.awe().then((res) => (state.sheetsIconList = res));
|
2021-03-04 18:18:26 +08:00
|
|
|
|
};
|
|
|
|
|
// 页面加载时
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
initGetStyleSheets();
|
|
|
|
|
});
|
|
|
|
|
return {
|
|
|
|
|
...toRefs(state),
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.awesome-container {
|
|
|
|
|
.iconfont-row {
|
|
|
|
|
border-top: 1px solid #ebeef5;
|
|
|
|
|
border-left: 1px solid #ebeef5;
|
|
|
|
|
.el-col:nth-child(-n + 24) {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
.iconfont-warp {
|
|
|
|
|
text-align: center;
|
|
|
|
|
border-right: 1px solid #ebeef5;
|
|
|
|
|
border-bottom: 1px solid #ebeef5;
|
|
|
|
|
height: 120px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
display: flex;
|
|
|
|
|
&:hover {
|
|
|
|
|
.iconfont-warp-value {
|
|
|
|
|
i {
|
|
|
|
|
color: var(--color-primary);
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.iconfont-warp-label {
|
|
|
|
|
color: var(--color-primary);
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.iconfont-warp-value {
|
|
|
|
|
i {
|
|
|
|
|
color: #606266;
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.iconfont-warp-label {
|
|
|
|
|
color: #99a9bf;
|
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|