Commit 5787cddc by 史敦盼

svg-icon注册

1 parent d4377063
......@@ -28,6 +28,7 @@
"@vue/cli-service": "~5.0.0",
"node-sass": "^6.0.1",
"sass-loader": "^10.0.1",
"svg-sprite-loader": "^6.0.11",
"vue-template-compiler": "^2.6.14"
},
"browserslist": [
......
<template>
<svg :class="svgClass" aria-hidden="true" v-on="$listeners">
<use :xlink:href="iconName" />
</svg>
</template>
<script>
export default {
name: 'SvgIcon',
props: {
iconClass: {
type: String,
required: true
},
className: {
type: String,
default: ''
}
},
computed: {
iconName() {
return `#icon-${this.iconClass}`
},
svgClass() {
if (this.className) {
return 'svg-icon ' + this.className
} else {
return 'svg-icon'
}
},
}
}
</script>
<style scoped>
.svg-icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
</style>
import Vue from 'vue'
import SvgIcon from '@/components/SvgIcon'// svg component
// register globally
Vue.component('svg-icon', SvgIcon)
const req = require.context('./svg', false, /\.svg$/)
const requireAll = requireContext => requireContext.keys().map(requireContext)
requireAll(req)
<svg
t="1714268548503"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="13918"
width="30"
height="30"
>
<path
d="M0 256C0 114.6112 114.6112 0 256 0h512c141.3888 0 256 114.6112 256 256v512c0 141.3888-114.6112 256-256 256H256C114.6112 1024 0 909.3888 0 768V256z"
fill="#0d857f"
opacity=".6"
p-id="13919"
data-spm-anchor-id="a313x.search_index.0.i9.76a23a81azHzXJ"
class="selected"
></path>
<path
d="M627.968 768V256h64v512h-64z m-114.688-499.1488l51.456 38.4-152.832 204.8 152.832 204.8-51.456 38.4-181.248-243.2 181.248-243.2z"
fill="#FFFFFF"
p-id="13920"
></path>
</svg>
\ No newline at end of file
# replace default config
# multipass: true
# full: true
plugins:
# - name
#
# or:
# - name: false
# - name: true
#
# or:
# - name:
# param1: 1
# param2: 2
- removeAttrs:
attrs:
- 'fill'
- 'fill-rule'
......@@ -8,7 +8,7 @@ import 'element-ui/lib/theme-chalk/index.css'
import './styles/element-variables.scss'
import './styles/common.scss'
import initDirective from './directive'
import './icons' // icon
import { postRequest, postRequestShared } from '@/api/index'
initDirective(Vue)
Vue.prototype.$echarts = echarts
......
......@@ -4,7 +4,7 @@
* @Autor: pan
* @Date: 2024-04-23 11:30:05
* @LastEditors: pan
* @LastEditTime: 2024-05-06 20:40:11
* @LastEditTime: 2024-05-07 08:55:57
-->
<template>
<div class="dataMapping w-100">
......@@ -70,30 +70,7 @@
</div>
<div class="right-content flex-1 flex" :class="{ 'hide-left': collapse }">
<div class="collapse" @click="collapse = !collapse">
<svg
t="1714268548503"
class="icon"
viewBox="0 0 1024 1024"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
p-id="13918"
width="30"
height="30"
>
<path
d="M0 256C0 114.6112 114.6112 0 256 0h512c141.3888 0 256 114.6112 256 256v512c0 141.3888-114.6112 256-256 256H256C114.6112 1024 0 909.3888 0 768V256z"
fill="#0d857f"
opacity=".6"
p-id="13919"
data-spm-anchor-id="a313x.search_index.0.i9.76a23a81azHzXJ"
class="selected"
></path>
<path
d="M627.968 768V256h64v512h-64z m-114.688-499.1488l51.456 38.4-152.832 204.8 152.832 204.8-51.456 38.4-181.248-243.2 181.248-243.2z"
fill="#FFFFFF"
p-id="13920"
></path>
</svg>
<SvgIcon className="my-collapse" icon-class="collapse" />
</div>
<transition name="slide">
<div style="width: 50%" v-show="!collapse">
......@@ -167,6 +144,7 @@
<script>
import Add from './Add.vue'
import MxGraph from './MxGraph.vue'
import SvgIcon from '@/components/SvgIcon'
import {
getAutomaticGraphing,
query_jia_gou_ceng_ci_new,
......@@ -197,7 +175,7 @@ export default {
checkedNodes: []
}
},
components: { MxGraph, Add },
components: { MxGraph, Add, SvgIcon },
created() {
this.getOptions()
},
......@@ -681,4 +659,8 @@ export default {
}
}
}
.my-collapse {
width: 100%;
height: 100%;
}
</style>
......@@ -4,7 +4,7 @@
* @Autor: pan
* @Date: 2024-04-28 11:10:26
* @LastEditors: pan
* @LastEditTime: 2024-04-28 17:02:34
* @LastEditTime: 2024-05-07 08:32:57
*/
// const items = [
// '财务',
......@@ -205,7 +205,7 @@ const dataSubjectRelationshipGraphMixin = {
// layout.edgeRouting = false;
layout.execute(this.graph.getDefaultParent())
this.graph.fit();//自适应
this.graph.center(true,true,0.2,0.3);// 调整整体图形位于画布的位置
this.graph.center(true,true,0.2,0.1);// 调整整体图形位于画布的位置
var sc = this.graph.getView().getScale();//获取当前的缩放比例
this.graph.zoomTo(Math.round(sc/2));//在缩放一半,否则是满屏状态,不好看
} finally {
......
const { defineConfig } = require('@vue/cli-service')
const path = require('path')
function resolve(dir) {
return path.join(__dirname, dir)
}
// const ip = '43.143.211.42';
// const ip = '172.20.10.3';
// const ip = '172.20.10.9'; // 何鹏
// const ip = '192.168.0.120';
// const ip = '172.20.10.7'; // 李振
// const ip = '192.168.0.105'; // 李振
// const ip = '192.168.137.229'; // 何鹏
// const ip = '192.168.0.103'; // 何鹏
// const ip = '192.168.0.107'; // 谢皓
// const ip = '192.168.137.146'; // 谢皓
// const ip = '2068224he2.51mypc.cn'; // 谢皓
const ip = '192.168.0.102'
// const ip = '192.168.0.13';
const ip = '192.168.0.102';
// const ip = '192.168.137.229'
module.exports = defineConfig({
transpileDependencies: true,
//如果是hash模式, publicPath:"";如果是history, publicPath:"/"
// publicPath: "/",
devServer: {
hot: true,
port: 8080,
proxy: {
'/eadc-shared-ability': {
target: `http://${ip}:80/`, // 共享能力
// target: `http://${ip}:19000/`, // 共享能力
changeOrigin: true,
// secure: false,
// pathRewrite: { '^/api/eadc-shared-ability': '/eadc-shared-ability' },
},
'/eadc-architecture': {
target: `http://${ip}:80/`, // 架构元模型
// target: `http://${ip}:19000/`, // 架构元模型
changeOrigin: true,
// secure: false,
// pathRewrite: { '^/api/network': '' },
},
'/eadc-knowledge-pool': {
target: `http://${ip}:80/`, // 架构知识库
// target: `http://${ip}:19000/`, // 架构知识库
changeOrigin: true,
// secure: false,
// pathRewrite: { '^/api': '' },
......@@ -38,4 +54,19 @@ module.exports = defineConfig({
return args
})
},
chainWebpack(config) {
// set svg-sprite-loader
config.module.rule('svg').exclude.add(resolve('src/icons')).end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]',
})
.end()
},
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!