定制 metrixinfo/nova-iframe 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

metrixinfo/nova-iframe

最新稳定版本:v4.0.1

Composer 安装命令:

composer require metrixinfo/nova-iframe

包简介

A Laravel Nova iFrame field.

README 文档

README

This Laravel Nova field enables you to display HTML in an iFrame so it does not affect any of the other HTML on the page. It is only visible on the Details view.

Installation

Install the package into a Laravel app that uses Nova with Composer:

composer require metrixinfo/nova-iframe:^4.0
Nova Version iFrame Version
Nova 3 ^1.0
Nova 4 ^4.0

Usage

Add the field to your resource in the fields method:

use Metrixinfo\Nova\Fields\Iframe\Iframe;
...
...
Iframe::make('HTML Content','html_content'),

If you are only storing a URL and would like that previewed in the iFrame, you can use a closure to retrieve the HTML. This also helps getting around iframe security issues such as http content being called from https. You can use file_get_contents, curl, GuzzleHttp etc. to retrieve the HTML content.

use Metrixinfo\Nova\Fields\Iframe;
...
...
Iframe::make('HTML Content', function (){
    return \file_get_contents('https://www.google.com/');
}),

Options

Size

You may pass in the size of the iframe. Values can be numeric or string.

use Metrixinfo\Nova\Fields\Iframe\Iframe;
...
...
Iframe::make('HTML Content','html_content')->size('100%', 600),

Style

You may pass CSS styles to the iframe.

use Metrixinfo\Nova\Fields\Iframe\Iframe;
...
...
Iframe::make('HTML Content','html_content')->style('border: 10px solid black;'),

Classes

You may pass in classes to the iframe.

use Metrixinfo\Nova\Fields\Iframe\Iframe;
...
...
Iframe::make('HTML Content','html_content')->classes('iframe-bordered iframe-large'),

Options may be chained

ie:

use Metrixinfo\Nova\Fields\Iframe\Iframe;
...
...
Iframe::make('HTML Content','html_content')
    ->style('border: 10px solid black;')
    ->size('100%', 600)
    ->classes('iframe-bordered iframe-large'),

Note: Iframe will only be displayed on the Detail view

统计信息

  • 总下载量: 338.04k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-19