提交 21c400c3 编写于 作者: W whk

侧边栏组件已经完成,顶部的组件和内容组件有待完成

上级 08be1d62
......@@ -19,38 +19,37 @@
<!-- </div> -->
<!-- <TitleMune :isActive = "curActive === 'faxian'" @active = "curActive = 'faxian'">
</TitleMune> -->
<div id="app" style="width: 250px;">
<channelsSearch></channelsSearch> <!-- 这个是channelsSearch频道搜索组件 -->
<TitleMenu :isActive="activeId === 100" @active="activeId = 100">
<template v-slot:title>
<!-- <div id="app" style="width: 250px;"> -->
<!-- <channelsSearch></channelsSearch> -->
<!-- 这个是channelsSearch频道搜索组件 -->
<!-- <TitleMenu :isActive="activeId === 100" @active="activeId = 100"> -->
<!-- <template v-slot:title> -->
<!-- v-slot:title是将这里的值传给TitleMenu中名为title的插槽 -->
发现频道
</template>
<template v-slot:icon>
<!-- 发现频道 -->
<!-- </template> -->
<!-- <template v-slot:icon> -->
<!-- v-slot:icon是将这里的值传给TitleMenu中名为icon的插槽 -->
>
</template>
</TitleMenu>
<!-- > -->
<!-- </template> -->
<!-- </TitleMenu> -->
<!-- <Channel :data="{name:'动漫',channel_count:'222'}"></Channel> -->
<!-- 首先接收子组件传来的事件,将activeId数据传递给子组件进行判断 -->
<channelList :columns="2" :activeId="activeId" @active="activeId = $event"></channelList>
</div>
<!-- <channelList :columns="2" :activeId="activeId" @active="activeId = $event"></channelList> -->
<!-- </div> -->
<!-- <div>
<AsideComp style="width: 250px; height: 500px;"></AsideComp>
</div> -->
<Channels></Channels>
</template>
<script>
// 关系:App-->TitleMenu-->Item
import HelloWorld from './components/HelloWorld.vue'
import TitleMenu from './components/TitleMenu.vue'
import channelList from './components/channelList.vue'
import channelsSearch from './components/channelsSearch.vue'
import Channels from './pages/Channels.vue'
// import Channel from './components/channel.vue'
export default {
name: 'App',
components: {
HelloWorld,
TitleMenu,
channelList,
channelsSearch
Channels
// AsideComp
// Channel,
},
// methods:{
......@@ -59,13 +58,13 @@
// console.log("执行了一次搜索",e)
// }
// },
data() {
return {
select: false, //true或者false赋值的时候不能加引号,否则会报错
activeId: 100
// data() {
// return {
// select: false, //true或者false赋值的时候不能加引号,否则会报错
// activeId: 100
}
}
// }
// }
}
</script>
<!--
......
<template>
<div class="asideComp">
<channelsSearch></channelsSearch> <!-- 这个是channelsSearch频道搜索组件 -->
<TitleMenu :isActive="activeId === 100" @active="activeId = 100">
<template v-slot:title>
<!-- v-slot:title是将这里的值传给TitleMenu中名为title的插槽 -->
发现频道
</template>
<template v-slot:icon>
<!-- v-slot:icon是将这里的值传给TitleMenu中名为icon的插槽 -->
>
</template>
</TitleMenu>
<!-- <Channel :data="{name:'动漫',channel_count:'222'}"></Channel> -->
<!-- 首先接收子组件传来的事件,将activeId数据传递给子组件进行判断 -->
<channelList :columns="2" :activeId="activeId" @active="activeId = $event"></channelList>
</div>
</template>
<script>
// 关系:App-->TitleMenu-->Item
import TitleMenu from './TitleMenu.vue'
import channelList from './channelList.vue'
import channelsSearch from './channelsSearch.vue'
// import Channel from './components/channel.vue'
export default {
components: {
TitleMenu,
channelList,
channelsSearch
// Channel,
},
// methods:{
// handleSearch(e){
// // 这里的e是接收到search.vue传过来的值,也就是input中输出搜索的值,并将其打印出来测试
// console.log("执行了一次搜索",e)
// }
// },
data() {
return {
select: false, //true或者false赋值的时候不能加引号,否则会报错
activeId: 100
}
}
}
</script>
<style scoped>
.asideComp{
width: 100%;
height: 100%;
overflow: auto;
/* 溢出部分自动添加滚动条 */
}
</style>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
<template>
<div class="container">
<header class="head">
<!-- 如果输入了一个自定义的标签,那么浏览器渲染这个标签的时候的display就为inline,也就是一个行元素 -->
<slot name="head"></slot>
</header>
<div class="mid">
<div class="left">
<slot name="left"></slot>
</div>
<div class="right">
<slot name="right" class="content"></slot>
</div>
</div>
</div>
</template>
<script>
export default {
}
</script>
<style scoped>
.container {
position: fixed;
/* container的位置是固定的 */
width: 100%;
height: 100%;
left: 0;
top: 0;
}
.head {
width: 100%;
height: 50px;
top: 0;
left: 0;
position: absolute;
z-index: 1;
/* 将head的position设置为absolute,再将z-index设置为1,就能够实现head在最上面
mid在下面,这样就不会覆盖阴影了*/
box-shadow: 5px 5px 7px rgba(0, 0, 0, 0.15);
/* 设置元素的阴影样式 */
/* 第一个值是偏移量(向右为正,向右为负)、第二个值是偏移量(向下为正,向上为负)、
第三个值是模糊程度(向右为正,向右为负)、第四个值为阴影颜色,一般用rgba(0,0,0,0.5),其中0.5为透明度 */
}
.mid {
position: absolute;
/* 元素的位置是绝对的 */
top: 50px;
bottom: 0;
left: 0;
right: 0;
}
.left {
float: left;
width: 250px;
height: 100%;
}
.right {
overflow: hidden;
background: #E7E7E7;
height: 100%;
padding-top: 50px;
padding-left: 200px;
padding-right: 200px;
}
</style>
......@@ -61,6 +61,9 @@
box-sizing: border-box;
/* 使元素的padding和边框之和占比100%,这样不会出现设置宽高100%以后有超出范围的情况 */
}
.search-area input::placeholder{
color: #999999;
}
.icon{
position: absolute;
/* 子元素绝对定位,则父元素要相对定位 */
......
<template>
<Layout>
<template v-slot:head>
头部
</template>
<!-- v-slot中的赋值是用:,而不是= -->
<template v-slot:left>
<AsideComp></AsideComp>
</template>
<template v-slot:right>
右边主要内容部分
</template>
</Layout>
</template>
<script>
import AsideComp from '../components/AsideComp.vue'
import Layout from '../components/Layout.vue'
export default{
components:{
AsideComp,
Layout
}
}
</script>
<style>
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册