<template>
  <el-input v-model="itemData[index]" :type="showType">
    <Icon slot="suffix" type="icon-yanjing" class="el-input__icon cur-point eye-style"
          @click.native.stop="changeType"></Icon>
  </el-input>
</template>

<script>
export default {
    props: {
        index: {
            type: String,
            default: 'password'
        },
        itemData: {
            type: Object,
            default: function () {
                return {};
            }
        }
    },
    data () {
        return {
            showType: 'password'
        };
    },
    methods: {
        changeType () {
            this.showType = this.showType === 'password' ? 'text' : 'password';
        }
    }
};
</script>
<style lang="scss">
  .eye-style{
    font-size: 18px;
  }
</style>
