zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    ExtJS5入门
    时间序列异常检测
    RNN实例
    数据清洗入门
    异常检测LOF
    sklearn异常检测demo
    孤立森林(Isolation Forest)
    WCF初见之SQL数据库的增删改查
    NHibernate与EF(Entity Framework)的区别
    解决IIS7虚拟目录出现HTTP 错误 500.19(由于权限不足而无法读取配置文件)的问题
  • 原文地址:https://www.cnblogs.com/cnchengv/p/11743671.html
Copyright © 2011-2022 走看看