erikgall/flash-alert

此包最新版本(v1.0.2)没有可用的许可证信息。

全宽VueJS闪告警

安装: 332

依赖项: 0

建议者: 0

安全: 0

星星: 5

观察者: 2

分支: 0

开放问题: 1

语言:CSS

v1.0.2 2016-06-28 21:33 UTC

This package is auto-updated.

Last update: 2024-09-15 16:30:07 UTC


README

需求

  1. Laravel
  2. Laravel Elixir
  3. VueJS
  4. Laravel-Elixir-Vueify

安装

  1. 从您的项目根目录运行以下命令

composer require erikgall/flash-alert

  1. 将以下行添加到您的 config/app.php 文件中的服务提供者

EGALL\FlashAlert\FlashAlertServiceProvider::class

  1. 在命令行运行以下命令以发布资源

php artisan vendor:publish

  1. 像这样导入组件(假设您在位于 resources/assets/js 的主 app.js 内)
 import FlashAlert from './components/flash-alert.vue';
  1. 将组件添加到您的 VueJs 组件
new Vue({
    el: '#app',
    components: {
        FlashAlert
    }
});
  1. 将以下行添加到您的主 blade 布局文件中。此行必须被 div#app 包围
<div id="app">
    @include('vendor.flash.alert')
</div>
  1. 将 Sass 文件添加到您的主 app.sass 文件中
@import "vendor/alert";
// For animations the package includes a sass copy of animate.css
@import "vendor/animate";
  1. 运行 gulp

使用方法

使用此包的最简单方法是在控制器中这样使用

class AuthController extends Controller {

    public function login() {

        // Login Success
        alert()->success('You have been successfully signed in.')->autohide(4000);

        return redirect()->to('/users');

    }

}