Enterprise-level component library based on Bootstrap and Blazor

star nuget master download license repo commit

QRCode

Generate QR code

Click the Generate button to generate a QRCode

Demo

Attributes

Loading...
@page "/qrcodes"

<h3>@Title</h3>

<h4>@SubTitle</h4> 

<Block Title="@BaseUsageText" Introduction="@IntroText1">
    <QRCode OnGenerated="@OnGenerated"></QRCode>
    <BlockLogger @ref="Trace" class="mt-3" />
</Block>

<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.Pages.Components;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.Extensions.Localization;
using Microsoft.AspNetCore.Components;

namespace BootstrapBlazor.Shared.Pages
{
    /// <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( Full) 675147445 Welcome to join the group discussion
Themes
Bootstrap
Ant Design (完善中)
Bluma (完善中)
LayUI (完善中)
Motronic (已集成)
An error has occurred. This application may no longer respond until reloaded. Reload