vue 构建根组件_为Vue 2构建的IP输入组件

vue 构建根组件

Vue IP (Vue IP)

An ip address input with port and material design support.

具有端口和材料设计支持的IP地址输入。

安装 (Install)

$ yarn add vue-ip

用法 (Usage)

import VueIp from 'VueIp';

new Vue({
    components: {
        VueIp
    },
    data() {
        return {
            ip: '127.0.0.1', // or null
            port: '8888', // or null
        };
    },
    methods: {
        
        /**
        * Will be called on changes to IP address or port 
        */
        change(ip, port, valid) {
            console.log(ip, port, valid);
        }
        
    },
    template: '<vue-ip :ip="ip" :port="port" :on-change="change" theme="material"></vue-ip>'
})

支持 (Supports)

  • Pasting (with IP or with IP and port)

    粘贴(使用IP或使用IP和端口)

  • IP Validation

    IP验证

  • Optional material design theme

    可选的材料设计主题

  • Optional Port

    可选端口

  • No sub dependencies

    没有子依赖性

道具 (Props)

PropTypeOptions
on-changefunctionWill be called when changes
ipstringnull or ip address '127.0.0.1'
portstringnull or '8080'
placeholderbooleanwill show a dummy ip address within the placeholder
themestring'material' (material design themed)
Struts类型选件
不断变化功能更改时将被调用
ipnull或ip地址'127.0.0.1'
港口null或'8080'
占位符布尔值将在占位符中显示一个虚拟IP地址
主题“材料”(以材料设计为主题)

翻译自: https://vuejsexamples.com/a-ip-input-component-built-for-vue-2/

vue 构建根组件