OpenHarmony三方组件:MaterialRadio

Handpc
发布于 2023-3-17 10:57
浏览
0收藏

Material_Component_Radio

Material component radio design in OpenHarmony.

Download & Install

Install using npm

​npm i ohos-material-radio​

Details about OpenHarmony NPM environment configuration, see at ​​here​

Usage Instructions

  1. Import files and code dependencies

import { RadioButton, RadioGroup, RadioOption, RadioModel }  from '@ohos/material-radio'

  1. Initialize model data

private radioModel: RadioModel = new RadioModel(1, "Radio Label")

  1. Code for creating radio button

RadioButton({
    checked: true,
    model: this.radioModel,
    onCheckChange: (selectedRadioId) => {
        console.log("Selected Radio Button Id:: " + selectedRadioId);
    }
})

 OpenHarmony三方组件:MaterialRadio-鸿蒙开发者社区

  1. Code for creating radio group

RadioGroup(
    {
        selectedRadioId: 1,
        options: [new RadioOption(1, "Option 1"), new RadioOption(2, "Option 2")],
        onCheckChange: (selectedRadioId) => {
            console.log("Selected Radio Button Id:: " + selectedRadioId);
        }
    }
)

 OpenHarmony三方组件:MaterialRadio-鸿蒙开发者社区

Compatibility

Supports OpenHarmony API version 8

Code Contribution

If you find any problems during usage, you can submit an ​​Issue​​​ to us. Of course, we also welcome you to send us ​​PR​​.

Open source License

This project is based on ​​Apache License 2.0​​, please enjoy and participate in open source freely.

Reference:

Design by : Dharma Seelan



文章转载自:​​https://gitee.com/openharmony-tpc/MaterialRadio​

分类
MaterialRadio-master.zip 116.84K 6次下载
已于2023-3-17 10:57:22修改
收藏
回复
举报
回复
    相关推荐