在下面的代码我需要打印color在Hex format.
First Print语句以RGB格式显示值rgb(102,102,102).
在第二个语句显示值在Hex 其中#666666
但是我手动将值输入到第二个print语句中102,102,102.
有没有办法将我从第一个语句(Color)获得的值传递给第二个print语句并获得结果?
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Google {
public static void main(String[] args) throws Exception {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com/");
String Color = driver.findElement(By.xpath("//div[@class='gb_e gb_f gb_g gb_xb']/a")).getCssValue("color");
System.out.println(Color);
String hex = String.format("#%02x%02x%02x", 102,102,102);
System.out.println(hex);
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试从孩子向父母发出多个参数。最好的方法是什么。
孩子
getUpdated(value, type) {
if (type === 'students') {
this.students = value.map(val => val.id);
}
if (type === 'programs') {
this.programs = value.map(val => val.code);
}
this.$emit('selectedOptions', students:this.students, programs:this.programs );
},
Run Code Online (Sandbox Code Playgroud)
家长
onSelectedOption(students, programs) {
if (students !== undefined || students.length > 1) {
this.students = students;
}
if (programs !== undefined || programs.length > 1) {
this.programs = programs;
}
},
Run Code Online (Sandbox Code Playgroud) 我有一个传递 id 的函数。URL 中的参数 id 正在更改,但视图没有刷新,我得到相同的内容。如果我是冷漠的页面,它工作得很好。
<a @click.prevent="user(userId)"> </a>
methods:
user(id) {
this.$router.push({ name: 'user', params: { id } });
},
Run Code Online (Sandbox Code Playgroud)