densen2014 / ZXingBlazor

Using ZXing Scan barcode/QR code in blazor
Apache License 2.0
93 stars 39 forks source link

Remove extra buttons #26

Closed Arsalan0098 closed 11 months ago

Arsalan0098 commented 1 year ago

Hello, How can I remove the ScanBtn and ResetBtn? I could not find a way to remove them. Thank you

densen2014 commented 1 year ago

you can use your UI like this, or PR a remove button function to ths project, : ->

https://github.com/densen2014/ZXingBlazor/blob/master/Demo.Server/Pages/BarcodeReaderPage.razor

line 94

    <BarcodeReader ScanResult="((e) => { BarCodeCustom=e; ShowScanBarcodeCustom = !ShowScanBarcodeCustom; })"
                   Close="(()=>ShowScanBarcodeCustom=!ShowScanBarcodeCustom)"
                   OnError="OnError"
                   UseBuiltinDiv="false"
                   @ref="barcodeReaderCustom" />

    <div @ref="barcodeReaderCustom.barcodeScannerElement">
        <div style="width: 480px; max-width: 100%">
            <button class="btn btn-outline-success p-2 m-1 w-25" data-action="startButton">扫描</button>
            <button class="btn btn-outline-success p-2 m-1 w-25" data-action="resetButton">重置</button>
            <button type="button" class="btn btn-outline-success p-2 m-1 w-25" data-action="closeButton">Close</button>

            <div data-action="sourceSelectPanel" style="display:none">
                <label for="sourceSelect">选择设备:</label>
                <select data-action="sourceSelect" style="max-width:100%" class="form-control">
                </select>
            </div>
            <div>
                <video id="video" playsinline autoplay style="height:480px;width: 640px;border: 1px solid red"></video>
            </div>
        </div>
    </div>
EmilAlipiev commented 8 months ago

was there a breaking change? this code doesnt work anymore. barcodeReaderCustom is always null when i try on blazor server

densen2014 commented 8 months ago

yes,sorry, element name was change

see the last demo

EmilAlipiev commented 8 months ago

I saw that already but problem is rendering within custom components like below. in this case I use mudblazor and this code doesnt work. I have tried also using your demo project adding MudPaper around. even using any other div tag is not working.

   <MudPaper>
                <BarcodeReader ScanResult="ScanResult"
                               UseBuiltinDiv="false"
                               @ref="barcodeReaderCustom" OnError="OnError" Close="(() => ShowScanBarcodeCustom = !ShowScanBarcodeCustom)"/>
            </MudPaper>
densen2014 commented 8 months ago

give me a full demo url or zip Densen informatica在 2023年11月12日,17:03,Emil Alipiev @.***> 写道: I saw that already but problem is rendering within custom components like below. in this case I use mudblazor and this code doesnt work. I have tried also using your demo project adding MudPaper around. even using any other div tag is not working.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you modified the open/close state.Message ID: @.***>