2021-03-03 18:48:41 +08:00
|
|
|
|
<template>
|
2021-03-15 12:44:58 +08:00
|
|
|
|
<div class="iconfont-container">
|
|
|
|
|
<el-card shadow="hover" :header="`iconfont 字体图标(自动载入):${sheetsIconList.length}个`">
|
|
|
|
|
<el-row class="iconfont-row">
|
|
|
|
|
<el-col :xs="12" :sm="8" :md="6" :lg="4" :xl="2" v-for="(v, k) in sheetsIconList" :key="k">
|
|
|
|
|
<div class="iconfont-warp">
|
|
|
|
|
<div class="flex-margin">
|
|
|
|
|
<div class="iconfont-warp-value">
|
|
|
|
|
<i :class="v" class="iconfont"></i>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="iconfont-warp-label mt10">{{ v }}</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
2021-03-03 18:48:41 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-03-15 12:44:58 +08:00
|
|
|
|
import { toRefs, reactive, onMounted } from 'vue';
|
|
|
|
|
import initIconfont from '/@/utils/getStyleSheets.ts';
|
2021-03-03 18:48:41 +08:00
|
|
|
|
export default {
|
2021-04-01 11:13:38 +08:00
|
|
|
|
name: 'pagesIocnfont',
|
2021-03-15 12:44:58 +08:00
|
|
|
|
setup() {
|
|
|
|
|
const state = reactive({
|
|
|
|
|
sheetsIconList: [],
|
|
|
|
|
});
|
|
|
|
|
// 初始化获取 css 样式,这里使用阿里的图标(记得加上前缀 `iconfont`),其它第三方请自行做判断
|
|
|
|
|
const initGetStyleSheets = () => {
|
|
|
|
|
initIconfont.ali().then((res: any) => (state.sheetsIconList = res));
|
|
|
|
|
};
|
|
|
|
|
// 页面加载时
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
initGetStyleSheets();
|
|
|
|
|
});
|
|
|
|
|
return {
|
|
|
|
|
...toRefs(state),
|
|
|
|
|
};
|
|
|
|
|
},
|
2021-03-03 18:48:41 +08:00
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.iconfont-container {
|
2021-03-15 12:44:58 +08:00
|
|
|
|
.iconfont-row {
|
|
|
|
|
border-top: 1px solid #ebeef5;
|
|
|
|
|
border-left: 1px solid #ebeef5;
|
|
|
|
|
.iconfont-warp {
|
|
|
|
|
text-align: center;
|
|
|
|
|
border-right: 1px solid #ebeef5;
|
|
|
|
|
border-bottom: 1px solid #ebeef5;
|
|
|
|
|
height: 120px;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
display: flex;
|
2021-04-29 17:42:01 +08:00
|
|
|
|
transition: all 0.3s ease;
|
2021-03-15 12:44:58 +08:00
|
|
|
|
&:hover {
|
2021-04-29 17:42:01 +08:00
|
|
|
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: all 0.3s ease;
|
2021-03-15 12:44:58 +08:00
|
|
|
|
.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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-03 18:48:41 +08:00
|
|
|
|
}
|
2021-03-15 12:44:58 +08:00
|
|
|
|
</style>
|