一个common项目中有一个组件CommonMain,代码如下,项目执行npm link
<template>
<div class="main-box" >
<div class="header">
<div class="logo">
Bubbling
</div>
<div style="width: 60%"></div>
</div>
<div class="body">
<div class="left-menu">
main
</div>
</div>
</div>
</template>
<script>
export default {
name: "CommonMain"
}
</script>
<style scoped>
.header{
height: 60px;
line-height: 60px;
width: 100%;
border: none;
box-shadow: 0 4px 15px rgba(64,158,255,.08);
background-color: #FFFFFF;
z-index: 1;
position: relative;
display: flex;
justify-content: space-between;
}
.body{
height: 100%;
z-index: 0;
}
.left-menu{
width: 230px;
box-shadow: 0 4px 15px rgba(0,0,0,.1);
height: 100%;
background-color: #FFFFFF;
}
.logo{
width: 20%;
text-align: center;
font-size: 20px;
font-weight: bold;
}
</style>
另一个test项目使用npm link common引入公共项目
效果如下
CommonMain中随便添加一个样式效果,组件整个不起作用。
你这个是字体大小样式,但是你div里面并没有写字体,当然没有效果