1.0.8 • Published 2 years ago

kd-ip-input v1.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

kd-ip-input

An ip input component for Vue2.x

Demo

https://lu-shuo.github.io/kd-ip-input/

Usage

Install

npm install kd-ip-input --save

ES

Global import

// main.js
import KdIpInput from 'kd-ip-input';

Vue.use(KdIpInput)

On demand

import KdIpInput from 'kd-ip-input';

new Vue({
    components: {
        'kd-ip-input': KdIpInput
    },
    data() {
        return {
            ip: '127.0.0.1'
        };
    },
    methods: {
       handleBlur(val) {}
    },
    template: '<kd-ip-input v-model="ip" show-prefix show-port prefix="http" @blur="handleBlur"></kd-ip-input>'
})

Check (with element form)

<template>
    <el-form :model="form" :rule="rules" ref="form"> 
        <el-form-item
            label="IP地址:"
            prop="ipv4"
            required
        >
            <kd-ip-input
                v-model="form.ipv4"
                check-empty-on-blur
                @blur="$refs.form.validateField('ipv4')"
            />
        </el-form-item>
    </el-form>
</template>

<script>
export default {
    data() {
        return {
            form: {
                ipv4: '',
                rules: {
                    ipv4: [
                        {required: true, message: '请输入ip地址', trigger: 'blur'},
                    ],
                }
            }
        }
    }
}
</script>

Attributes

AttributeDescriptionTypeAccepted ValuesDefault
value / v-modelbinding valueString----
prefixnetwork protocol (required when showPrefix)Stringhttp/https/wss/ws--
showPrefixwhether use prefixBoolean--false
showPortwhether use portBoolean--false
disabledwhether input is disabledBoolean--false
checkEmptyOnBlurwhether check value is empty on blur(red border when empty)Boolean--false
clearablewhether to show clear buttonBoolean--false
themeColorhighlight colorString--#427bf1

Events

Event NameDescriptionParameters
blurtriggers when the input blurthe value of the input
1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago