• study vant


    vant 组件稍加改动就能应用于

    list-item

    <template>
    
        <div class="media-item view" v-if="options.title" @click="click">
    
            <div :style="{flexDirection: getViewStyle(options) }" style="display: flex;">
                <div class="media-title" 
                :class="{'media-title2': options.article_type === 1 || options.article_type === 2}"><span>{{options.title}}</span></div>
            
                <div v-if="options.image_list || options.image_url" class="image-section flex-row" :class="{'image-section-right': options.article_type === 2, 'image-section-left': options.article_type === 1}"
                :style="{flexDirection: 'row' }">
                    <img class="image-list1" :class="{'image-list2': options.article_type === 1 || options.article_type === 2}" v-if="options.image_url"
                    :src="options.image_url" />
                    <img class="image-list3" v-if="options.image_list" :src="source.url" v-for="(source, i) in options.image_list"
                    :key="i" />
                </div>
            </div>
            <div class="media-foot flex-row" style="flex-direction: row;">
                <div class="media-info flex-row" style="display:flex;flex-direction: row;">
                    <span class="info-text">{{options.author_name}}</span>
                    <span class="info-text">{{options.comments_count}}条评论</span>
                    
                    <span class="info-text">{{options.published_at}}</span>
                    
                </div>
    
            </div>
            <div class="media-item-line" style="position: absolute;"></div>
        </div>
    </template>
    
    <script>
        export default {
            props: {
                options: {
                    type: Object,
                    
                    default: function(/*e*/) {
                        return {}
                    }
                    
                }
            },
    
            data() {
                return {
                    options1: {
                        author_name:"36氪出海",
                        comments_count:10,
                        content:"",
                        article_type:1,
                        //cover:"https://pic.36krcnd.com/201910/25072501/lvaqh1a5mp8mduj3!heading",
                        image_url:"https://pic.36krcnd.com/201910/25072501/lvaqh1a5mp8mduj3!heading",
                        id:101711,
                        post_id:"5259650",
                        published_at:"191026 09:31",
                        title:"出海创投周报 | 拉美独角兽 Rappi 进军哥斯达黎加;Gojek 表示将为双重上市做准备"
                    },
                    
                }
            },
            mounted:function(){
                //this.options.image_url = this.options.cover
            },
    
            methods: {
                getViewStyle(options){
                    if(options.article_type === 1)
                        return 'row-reverse';
                    else if(options.article_type === 2 )    
                        return 'row';
                    else 
                        return 'column';
                },
    
                click() {
                    this.$emit('click');
                },
                /*
                close(e) {
                    this.$emit('close');
                }*/
            }
        }
    </script>
    
    <style lang="less">
    .media-item {
        flex: 1;
        flex-direction: column;
        padding: 6px 8px 6px 8px;
        display: flex;
        margin-bottom: 5px;
        border-bottom: 1px solid #ededed; 
    }
    
    .media-image-right {
        flex-direction: row;
    }
    
    .media-image-left {
        flex-direction: row-reverse;
    }
    
    .media-title {
        flex: 1;
        lines: 3;
        text-overflow: ellipsis;
        font-size: 14px;
        color: #555555;
        flex: 1;
    }
    
    .image-section{
         33%;
        margin-right: 3px;
    }
    
    .image-list1{
         100%;
    }
    
    .media-foot {
        margin-top: 5px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .info-text {
        margin-right: 5px;
        color: #999999;
        font-size: 12px;
        margin-right:10px; 
    }
    
    
    
    </style>

    login

    <template>
    
    <div >
    <van-nav-bar
      title="登陆"
      left-text="返回"
    
      left-arrow
      @click-left="onClickLeft"
      @click-right="onClickRight"
    />
    
        <van-cell-group class="user-group" style="margin-top:50px;margin-bottom:10px">
          <van-cell title="没有注册?先去注册" style="color: rgba(69, 90, 100, 0.6);" is-link />
        </van-cell-group>
    
    <van-cell-group>
      <van-field
        v-model="username"
        required
        clearable
        label="用户名"
        right-icon="question-o"
        placeholder="请输入用户名"
        @click-right-icon="$toast('question')"
      />
    
      <van-field
        v-model="password"
        type="password"
        label="密码"
        placeholder="请输入密码"
        required
      />
    <van-cell >
      <van-button @click="onClick" type="primary" style="margin-top:30px;100%;" size="normal">登录</van-button>
    </van-cell>
    
    </van-cell-group>
    
    </div>   
    </template>
    
    <script>
    
    import { api } from '../../common/api'
    
    export default {
      data() {
        return {
          username:'',
          password:'',
          ifWrite:false,
        };
      },
      mounted: function() {
      },
    
      methods: {
          async onClick(){
            //alert(this.username)
            const row = {name:this.username,password:this.password}
            let ret = await api.post('api/login?time='+new Date().getTime(),row,this)
            if(ret.code == 0){
              this.$store.state.logined = true;
              this.$router.push({path: '/list'});
            }
    
            
                },
    
      }
    };
    </script>
    
    
    
    <style lang="less">
    .user {
      &-poster {
         100%;
        height: 53vw;
        display: block;
      }
    
      &-group {
        margin-bottom: 15px;
      }
    
      &-links {
        padding: 15px 0;
        font-size: 12px;
        text-align: center;
        background-color: #fff;
    
        .van-icon {
          display: block;
          font-size: 24px;
        }
      }
    }
    </style>
  • 相关阅读:
    网络系统集成实习——第四天——2017.9.10
    网络系统集成实习——第三天——2017.9.9
    网络系统集成实习——第二天——2017.9.8
    网络系统集成实习——第一天——2017.9.6
    如何查找文献及规范参考文献引用格式(以石家庄铁道大学图书馆为例)
    MATLAB数值分析实验
    MATLAB常微分方程的数值解法
    MATLAB数值积分法
    【工匠大道】博客园小技巧
    【夯实PHP基础】PHP 面向对象
  • 原文地址:https://www.cnblogs.com/cnchengv/p/11743671.html
Copyright © 2020-2023  润新知