参考demo,使用.toString(2)就可以转为二进制// xxx.ets @Entry @Component struct TextTimerExample { textTimerController: TextTimerController = new TextTimerController() @State format: string = 'mm:ss.SS' @State sss: number = 12345 build() { Column() { Text(this.format).onClick(() => { this.format = this.sss.toString(2) }) } } }
参考demo,使用.toString(2)就可以转为二进制