Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>11.0.0-rc.2.1</Version>
</PropertyGroup>

<PropertyGroup>
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components Pdf Viewer</PackageTags>
Expand Down
10 changes: 9 additions & 1 deletion src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ namespace BootstrapBlazor.Components;
/// </summary>
public partial class PdfViewer
{
private const string StylePath = "_content/BootstrapBlazor.PdfViewer/pdf-viewer.css";

#if NET9_0_OR_GREATER
private string StyleUrl => Assets[StylePath];
#else
private static string StyleUrl => StylePath;
#endif

/// <summary>
/// <para lang="zh">获得/设置 文档 Url 属性</para>
/// <para lang="en">Gets or sets the url for the PDF file to be displayed</para>
Expand Down Expand Up @@ -96,7 +104,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
LoadedCallaback = nameof(TriggerOnLoaded),
NotSupportCallback = nameof(TriggerNotSupportCallback),
Url = GetAbsoluteUri(Url)
});
}, StyleUrl);

private string GetAbsoluteUri(string? url)
{
Expand Down
4 changes: 2 additions & 2 deletions src/components/BootstrapBlazor.PdfViewer/PdfViewer.razor.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { addLink } from "../BootstrapBlazor/modules/utility.js"
import Data from "../BootstrapBlazor/modules/data.js"

export async function init(id, invoke, options) {
await addLink("./_content/BootstrapBlazor.PdfViewer/pdf-viewer.css");
export async function init(id, invoke, options, styleUrl) {
await addLink(styleUrl)

const el = document.getElementById(id);
const pdfViewer = { el, invoke, options };
Expand Down
Loading