• 记录uniapp中遇到的问题


    1. 三目运算符切换类名

    <view :class="[clsFlag ? 'finish1' : 'finish']"  @click="submit" >提交</view>

    2.uniapp获取输入框中的内容

    <template>

    <view>

      <text class="name">原密码</text>   

      <input class="uni-input" :value='oPwd' :type="pwd" focus placeholder="填写原密码" @input="inputChange"/> </view>

    <view>

    </template>

    <script>
      export default {
        data() {
          return {
            oPwd:"",
            nPwd:"",
          }
        },
        methods: {
          inputChange(e) {
          this.oPwd = e.detail.value;
        }
      }
    </script>

     3. [Vue warn]: Duplicate keys detected: '0'. This may cause an update error. found in解决办法

     错误原因:一个template中有两个一样的v-for, key属性冲突导致

    <image v-for="(yello,yeIndex) in yelloScore" src="../static/img/light_star.png" class="star-ico" :key="yeIndex"></image>
    <image v-for="(gray,grIndex) in grayScore" src="../static/img/grey_star.png" class="star-ico" :key="grIndex"></image>

    解决方法:

    在第二个v-for中, key属性设置一下即可:

    <image v-for="(yello,yeIndex) in yelloScore" src="../static/img/light_star.png" class="star-ico" :key="yeIndex"></image>
    <image v-for="(gray,grIndex) in grayScore" src="../static/img/grey_star.png" class="star-ico" :key="grIndex+'a'"></image>
    

      

  • 相关阅读:
    无法远程连接mssqlserver2005服务器的解决
    can't init script for
    为什么要分层?
    如何判断控件是否已加载完成
    社团管理_第4组_需求分析报告
    FSF
    【转载】(翻译)反射的第二部分:Emit
    【转载】Emit学习基础篇基本概念介绍
    白话C#
    GCC
  • 原文地址:https://www.cnblogs.com/lxz123/p/13684600.html
Copyright © 2020-2023  润新知