更新记录
1.0.1(2022-09-20) 下载此版本
修复非自定义服务取值问题
1.0.0(2022-09-20) 下载此版本
基于lee-switch-ip修复及微调
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | - | - | - | - | - | - | - | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
√ | - | - | - | - | - | - | - | - | - | - |
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)
// 修改接口地址
}
}
}