# 开发者模式(developer)
开发者模式组件,方便开发测试人员切换环境。
# 基本使用
<itu-developer ref="developer" :defaultValue="defaultValue" :total='5' :list="list" @confirm="confirm"></itu-developer>
< script >
export default {
data() {
return {
list: [{
value: 'http://192.168.1.1',
label: '正式服务器'
}, {
value: 'http://192.168.1.2',
label: '测试服务器'
}, {
value: 'http://192.168.1.3',
label: '自定义服务器(非开发人员禁用)',
custom: true
}],
defaultValue: 'http://192.168.1.2'
}
},
onLoad({ title }) {
this.setNavigationBarTitle(title)
},
methods: {
show() {
this.$refs.developer.open()
},
confirm(val) {
this.defaultValue = val
}
}
} <
/script>
# Props
属性名 | 类型 | 默认值 | 说明 |
---|---|---|---|
total | Number | 10 | 点击次数达到目标值,触发设置 |
effectiveTime | Number | 5 | 有效时间(单位秒) |
themeColor | String | rgba(165, 165, 165, .2) | 主题颜色 |
list | Array | [] | [{ value: 'http://192.168.1.3', label: '自定义服务器(非开发人员禁用)', custom: true // 是否自定义}] |
defaultValue | String | 空 | 默认值 |
lang | String | 空 | 默认值 |
shape | String | square | 按钮形状,可选值 square、round、circle |
# Events
事件名称 | 类型 | 说明 |
---|---|---|
@confirm | Function | 开发者模式点击【确定】按钮时触发的事件 |
@open | Function | 开发者模式打开时触发的事件 |
@close | Function | 开发者模式关闭时触发的事件 |