uri
const url = 'https://jmw.baidu.com/JMRouter/webview?name=zhangsan&age=18';
let uriObj = new uri.URI(url);
let segments = uriObj.getSegment();
console.log('hello uri:', uriObj.toString())
console.log('hello scheme:', uriObj.scheme)
console.log('hello host:', uriObj.host)
console.log('hello segments:', JSON.stringify(segments))
let paramKeys = uriObj.getQueryNames();
for (let key of paramKeys) {
console.log('hello param:', key, uriObj.getQueryValue(key));
}
获取udid
hdc shell bm get --udid
安装hap包
hdc install xxx.hap
代码片段
??使用
const record: Record<string, Object> = {'agex': 1}
const age = record['age'] ?? record['age1'] ?? 43
console.log('hello = ', age);
默认参数
function test_default_param(num: number = 1, age: number = 11) {
console.log('num = ', num);
console.log('age = ', age);
}
function test_default_param2(num?: number, age?: number) {
console.log('num = ', num);
console.log('age = ', age);
}
宽度
.width('calc(100% - 20vp)')