zoukankan      html  css  js  c++  java
  • 记录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>
    

      

  • 相关阅读:
    javaSE第二十四天
    javaSE第二十三天
    javaSE第二十二天
    javaSE第二十一天
    javaSE第二十天
    javaSE第十九天
    python020 Python3 OS 文件/目录方法
    python019 Python3 File(文件) 方法
    python018 Python3 输入和输出
    python017 Python3 模块
  • 原文地址:https://www.cnblogs.com/lxz123/p/13684600.html
Copyright © 2011-2022 走看看