更新记录

1.0.1(2022-09-20)

修复非自定义服务取值问题

1.0.0(2022-09-20)

基于lee-switch-ip修复及微调


平台兼容性

Vue2 Vue3
×
App 快应用 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序
HBuilderX 3.5.3 × × × × ×
钉钉小程序 快手小程序 飞书小程序 京东小程序
× × × ×
H5-Safari Android Browser 微信浏览器(Android) QQ浏览器(Android) Chrome IE Edge Firefox PC-Safari
× × × × × × × × ×

xb-lee-switch-ip 用于开发过程中IP切换

原作者

原作者链接 使用过程有点问题,基于原版修复微调及修改集成方式。

方便开发测试人员随时切换测试服务器,代码比较简单,为了方便自己将这个功能封装一遍,可根据自己喜好随意修改 本身属于小玩意,大家随意取阅

组件接口文档

参数 名称 类型 必填 默认值
IPArray IP数组 Array(Object)
defaultIP 默认使用IP String
time 时间内满足条件打开IP选择器 Number 5000
clickNum 所限制的时间内点击达到多少次 Number 10

组件prop快速设置默认值

props: {
    // IP选择数组
    IPArray: {
        type: Array,
        default: function() {
            return [{
                ipConfig: 'http://192.168.1.6',
                title: '正式服务器'
            }, {
                ipConfig: 'http://192.168.1.10',
                title: '测试服务器'
            }, {
                ipConfig: 'http://192.168.1.7:8080',
                title: '自定义服务器(非开发人员禁用)'
            }]
        }
    },
    // 默认IP值 
    defaultIP:{
        type:String,
        default:"http://www.baidu.com"
    },
    // 时间范围限制(单位毫秒:1s=1000ms)
    time: {
        type: Number,
        default: 5000
    },
    // 触发条件(点击次数,建议为10次)
    clickNum: {
        type: Number,
        default: 10
    }
}

组件使用参考

    <view @click="openSwitchIp()">
        点击触发
    </view>
    <!-- IP选择器 -->
    <xb-lee-switch-ip ref="switchIp" @change="updateIP" :IPArray.sync="IPArray" :clickNum="3"></xb-lee-switch-ip>
export default {
    data() {
        return {
            IPArray:[{
                ipConfig: 'http://192.168.1.6',
                title: '正式服务器'
            }, {
                ipConfig: 'http://192.168.1.10',
                title: '测试服务器'
            }, {
                ipConfig: 'http://192.168.1.7:8080',
                title: '自定义服务器(非开发人员禁用)'
            }]
        }
    },
    method:{
        // 打开IP选择器
        openSwitchIp() {
            this.$refs.switchIp.openSelectIP()
        },
        // IP修改change事件
        updateIP(e) {
            console.log(e)
            // 修改接口地址
        }
    }
}

隐私、权限声明

1. 本插件需要申请的系统权限列表:

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

插件不采集任何数据

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问