Skip to content

MessageBar-DEMO


Default

Error

Blocked

Correct

Warning

vue
Default

<fv-MessageBar>
</fv-MessageBar>

Error

<fv-MessageBar status="error">
</fv-MessageBar>

Blocked

<fv-MessageBar status="blocked">
</fv-MessageBar>

Correct

<fv-MessageBar status="correct">
</fv-MessageBar>

Warning

<fv-MessageBar status="warning">
</fv-MessageBar>

MessageBar-Dark Theme


Default

Error

Blocked

Correct

Warning

MessageBar-Toast


  1. Standard
vue
<fv-button style="width: 200px;" @click="show1">Show MessageBar</fv-button>
javascript
this.$barWarning('This is a toast message.', {
    status: 'correct'
});
  1. Customize Message Template
vue
<fv-button style="width: 200px;" @click="show2">Show MessageBar</fv-button>
javascript
this.$barWarning(h('div', [
    h('span', { class: 'header' }, 'Message'),
    'This is a toast message.',
    h('a', 'Visit our website.')
]), {
    status: 'correct'
});
  1. Customize Control Template
vue
<fv-button style="width: 200px;" @click="show3">Show MessageBar</fv-button>
javascript
this.$barWarning(h('div', [
    h('span', { class: 'header' }, 'Message'),
    'This is a toast message.',
    h('a', 'Visit our website.')
]), {
    status: 'correct',
    showControl: true,
    autoClose: -1,
    control: x => {
        return h('div', {
            style: {
                display: "flex",
                alignItems: "center"
            }
        }, [
            h(resolveComponent('fv-button'), {
                onClick: () => {
                    alert('Yes');
                    x.cancel();
                },
            }, 'Yes'),
            h(resolveComponent('fv-button'), {
                onClick: () => {
                    alert('No');
                    x.cancel();
                },
                style: 'margin-left: 5px;' }, 'No')
        ]);
    }
});

SwiftWarning

Swift Warning

vue
<p id="example">Swift Warning</p>

<fv-button style="width: 200px;" @click="showSwiftWarning">Click to Show SwiftWarning</fv-button>
javascript
this.$swiftWarning(document.getElementById('example'), {
    color: "rgba(173, 38, 45, 1)",
    replaceTitle: "You clicked Swift Warning."
});

Properties


PropertyTypeRequiredDefaultDescription
statusNo'default'See the MessageBar status option.
showControlNofalseSee the MessageBar showControl option.
showCloseNotrueSee the MessageBar showClose option.
modestringNo'relative'See the MessageBar mode option.
autoClosenumberNo3000See the MessageBar autoClose option.
destroyobjectNo() => {}See the MessageBar destroy option.
themestringNo'global'See the MessageBar theme option.
disabledbooleanNofalseSee the MessageBar disabled option.
langstringNo"global"See the MessageBar lang option.

Events


EventArgumentsDescription
closeSee the component close option.

Slots


  1. Msg
vue
<template v-slot:msg>
    <span>Normal content <span class="header">Header content</span><a>Link</a></span>
</template>
  1. Control
vue
<template v-slot:control="x">
    <fv-button @click="x.cancel()">Yes</fv-button>
</template>

Toast


javascript
this.$barWarning(msg, options = {
    status: 'default',
    showControl: false,
    showClose: true,
    control: null,
    mode: 'fixed',
    autoClose: 3000
});

control_panel: x => h() // 传入具名插槽属性参数的函数, 函数返回值为$createElement函数
javascript
this.$swiftWarning(element, options = {
    color: "rgba(173, 38, 45, 1)",
    replaceTitle: "Swift Warning"
});

MIT Licensed