li-guang
2020-12-18 82c48f3b548145d0cb3c652c47ed4def1e3e4c77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<template>
    <!-- 知识库 -->
    <view class="container flex">
        <scroll-view class="list-left" scroll-y>
            <view v-for="(item,index) in list" class="list-left-row" @click="active(index)" :class="activeIndex==index?'active':''">
                <text class="font-14 gray"  @click="show(item)">{{item.primaryTitle}}</text>
                <!-- <view v-for="(sub,index) in item.subTitle" v-show="item.isShow" class="list-left-row-item" @click="selectItem(index)" :class="index==select?'select-item':''">
                    {{sub}}
                </view> -->
            </view>
        </scroll-view>
        <scroll-view class="list-right" scroll-y>
            <view class="flex align-center list-right-row">
                <image class="list-right-img ml-10" mode="aspectFit" src="../../static/images/head-img.jpg"></image>
                <view class="flex flex-v ml-10">
                    <text class="overflow-nowrap font-14">我是文章的标题</text>
                    <text class="overflow-omit font-14">我是文章的内容我是文章的内容我是文章的内容我是文章的内容</text>
                </view>
            </view>
        </scroll-view>
    </view>
</template>
 
<script>
    export default{
        data(){
            return{
                list:[
                    {
                        primaryTitle:'院装产品',
                        subTitle:['水果','蔬菜'],
                        isShow:false,
                    },
                    {
                        primaryTitle:'美容套餐',
                        subTitle:['水果','蔬菜'],
                        isShow:false
                    }
                ],
                select:'0',
                activeIndex:'0'
            }
        },
        methods:{
            show(item){
                item.isShow=!item.isShow
                this.select=0
            },
            selectItem(index){
                this.select=index
            },
            active(index){
                this.activeIndex=index
            }
        }
    }
</script>
 
<style>
    page{
        height: 100%;
    }
    .container{
        height: 100%;
        padding: 10px 0 0;
        box-sizing: border-box;
    }
    .list-left{
        width: 30%;
        height: 100%;
        text-align: center;
        background: #F6F6F8;
        border-radius: 4px;
        
    }
    .list-left-row{
        padding: 10px 10px;
        font-size: 16px;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    .list-left-row-item{
        width: 80px;
        margin-top: 8px;
        font-size: 14px;
        color: ;
    }
    .select-item{
        background: red;
        border-radius: 20px;
        color: #FFFFFF;
    }
    .active{
        background: #FFFFFF;
        color: #000000;
    }
    .list-right{
        width: 70%;
        text-align: center;
        padding: 0px 10px;
    }
    .list-right-row{
        border: 1px solid #EDEAF4;
        box-shadow:0 6px 6px rgba(237,234,244,0.5);
        border-radius: 4px;
        padding: 10px;
    }
    .list-right-img{
        width: 150px;
        height: 80px;
    }
    
    /* 超过两行显示省略号 */
    .overflow-omit{
        text-overflow: -o-ellipsis-lastline;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    /* 只能一行,超出显示省略号 */
    .overflow-nowrap{
        white-space:nowrap;
    }
</style>