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>
    

      

  • 相关阅读:
    [转载]四大Java EE容器
    [转载]javaEE规范和SSH三大框架到底有什么关系
    javaee包含的服务和组件
    Java类文件最大限制
    oracle给字段添加描述
    apache commons工具包
    redis教程
    git学习
    编程人物
    程序员必须了解的5大编程准则
  • 原文地址:https://www.cnblogs.com/lxz123/p/13684600.html
Copyright © 2011-2022 走看看