Просмотр исходного кода

field 控件 设置只读属性 增加 点击事件

wangyingjie 3 лет назад
Родитель
Сommit
db62d66efd
1 измененных файлов с 9 добавлено и 2 удалено
  1. 9 2
      src/components-app/base/dk-app-field/dk-app-field.vue

+ 9 - 2
src/components-app/base/dk-app-field/dk-app-field.vue

@@ -2,13 +2,13 @@
 <template>
   <van-field ref="input" :name="name" v-model="model" :center="center" :label="label" :size="size"
              :type="typeInput" :focus="focus" :colon="colon" :border="border"
-             :password="password"
+             :password="password"  :readonly="readonly":clickable="clickable"
              :maxlength="maxlength" :title-width="titleWidth" :placeholder="placeholder"
              :auto-focus="autoFocus" :is-link="isLink" :show-word-limit="showWordLimit"
              :arrow-direction="arrowDirection" :error="error" :format-trigger="formatTrigger" :formatter="formatter"
              :error-message="errorMessage" :error-message-align="errorMessageAlign" :input-align="inputAlign"
              :autosize="autosize" :left-icon="leftIcon" :right-icon="rightIcon"
-             @input="onInput" @focus="onFocus" @blur="onBlur">
+             @input="onInput" @focus="onFocus" @blur="onBlur" @click="onClick">
     <!-- label	自定义输入框标签,如果设置了label属性则不生效
       left-icon	自定义输入框头部图标
       right-icon	自定义输入框尾部图标
@@ -178,6 +178,13 @@ export default {
       this.$emit("input", this.model)
     },
     /**
+     * 点击事件
+     * @param {*} event
+     */
+    onClick(event) {
+      this.$emit("click", this.model)
+    },
+    /**
      * 输入内容时触发
      * @param {*} event
      */