Enterprise-level component library based on Bootstrap and Blazor

star nuget license download repo commit master coverage

QRCode

Generate QR code

Click the Generate button to generate a QRCode

Demo
<QRCode OnGenerated="@OnGenerated" ShowButtons="true"><QRCode>

Specify the contents of the QR code with the Content parameter

Demo
<QRCode Content="https://www.blazor.zone"><QRCode>

Attributes

Loading...
@page "/qrcodes"

<h3>@Title</h3>

<h4>@SubTitle</h4>

<DemoBlock Title="@BaseUsageText" Introduction="@IntroText1" Name="Normal">
    <QRCode OnGenerated="@OnGenerated" ShowButtons="true"></QRCode>
    <BlockLogger @ref="Trace" class="mt-3" />
    <Pre class="mt-3"><QRCode OnGenerated="@OnGenerated" ShowButtons="true"><QRCode></Pre>
</DemoBlock>

<DemoBlock Title="Direct build" Introduction="Specify the contents of the QR code with the <code>Content </code> parameter" Name="Direct">
    <QRCode Content="https://www.blazor.zone"></QRCode>
    <Pre class="mt-3"><QRCode Content="https://www.blazor.zone"><QRCode></Pre>
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/

using BootstrapBlazor.Shared.Common;
using BootstrapBlazor.Shared.Components;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.Extensions.Localization;
using Microsoft.AspNetCore.Components;

namespace BootstrapBlazor.Shared.Samples;

/// <summary>
/// 
/// </summary>
public sealed partial class QRCodes
{
    [NotNull]
    private string? Title { get; set; }

    [NotNull]
    private string? SubTitle { get; set; }

    [NotNull]
    private string? BaseUsageText { get; set; }

    [NotNull]
    private string? IntroText1 { get; set; }

    [NotNull]
    private string? SuccessText { get; set; }

    [NotNull]
    private string? CallbackDescription { get; set; }

    [Inject]
    [NotNull]
    private IStringLocalizer<QRCodes>? Localizer { get; set; }

    private BlockLogger? Trace { get; set; }
    /// <summary>
    /// OnInitialized 方法
    /// </summary>
    protected override void OnInitialized()
    {
        base.OnInitialized();

        Title ??= Localizer[nameof(Title)];
        SubTitle ??= Localizer[nameof(SubTitle)];
        BaseUsageText ??= Localizer[nameof(BaseUsageText)];
        IntroText1 ??= Localizer[nameof(IntroText1)];
        SuccessText ??= Localizer[nameof(SuccessText)];
        CallbackDescription ??= Localizer[nameof(CallbackDescription)];

    }

    private Task OnGenerated()
    {
        Trace?.Log(SuccessText);
        return Task.CompletedTask;
    }

    /// <summary>
    /// 获得属性方法
    /// </summary>
    /// <returns></returns>
    private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
    {
            // TODO: 移动到数据库中
            new AttributeItem() {
                Name = "OnGenerated",
                Description = CallbackDescription,
                Type = "Func<Task>",
                ValueList = " — ",
                DefaultValue = " — "
            }
    };
}

B 站相关视频链接

暂无

交流群

QQ Group:BootstrapAdmin & Blazor 795206915 675147445 Welcome to join the group discussion
Themes
Bootstrap
Motronic
Ant Design (完善中)
LayUI (完善中)
An error has occurred. This application may no longer respond until reloaded. Reload