提交 4de4144b 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

fix: 修改input光标颜色示例

上级 bcbc112d
......@@ -17,12 +17,12 @@ describe('component-native-input', () => {
// 测试焦点及键盘弹起
it('focus', async () => {
const input = await page.$('#uni-input-focus');
expect(await input.attribute('focus')).toBe(true)
expect(await input.attribute('focus')).toBe("true")
// expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(true)
await page.setData({
focus: false,
})
expect(await input.attribute('focus')).toBe(false)
expect(await input.attribute('focus')).toBe("false")
// await page.waitFor(1000)
// expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(false)
// await page.setData({
......@@ -141,10 +141,10 @@ describe('component-native-input', () => {
it("cursor-color", async () => {
await page.setData({
cursor_color: "transparent",
cursor_color: "red",
})
await page.waitFor(500)
expect(await (await page.$('#uni-input-cursor-color')).attribute("cursor-color")).toBe("transparent")
expect(await (await page.$('#uni-input-cursor-color')).attribute("cursor-color")).toBe("red")
})
it("afterAllTestScreenshot", async () => {
......
......@@ -137,8 +137,9 @@
</view>
<view>
<view class="uni-title" @click="changeCursorColor">
<text class="uni-title-text">设置光标颜色为透明(点击本行文字生效,再点复位)</text>
<view class="uni-title" style="flex-direction: row;align-items: center;">
<text class="uni-title-text">设置光标颜色为红色</text>
<switch style="margin-left: 10px;" @change="changeCursorColor" :checked="cursor_color=='red'"></switch>
</view>
<view class="input-wrapper">
<input id="uni-input-cursor-color" class="uni-input" :cursor-color="cursor_color" value="光标颜色" />
......@@ -301,13 +302,16 @@
test_check_input_value():number {
return this.onMaxLengthInputValue.length
},
changeCursorColor(){
if(this.cursor_color == "#3393E2"){
this.cursor_color = "transparent"
}else{
this.cursor_color = "#3393E2"
}
}
changeCursorColor(event: SwitchChangeEvent){
const transparent = event.detail.value;
if(transparent){
this.cursor_color = "red"
}else{
this.cursor_color = "#3393E2"
}
const input = uni.getElementById<UniInputElement>("uni-input-cursor-color")
input?.focus()
},
}
}
</script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册