vue-encyclopedia
Version:
## Project setup ``` npm install ```
117 lines (98 loc) • 3.28 kB
JavaScript
import { openBlock, createElementBlock, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, renderSlot } from 'vue';
var script$1 = {
name: "EnButton",
props: {
title: String,
small: Boolean,
icon: String,
iconsLeft: String,
iconsRight: String,
type: {
default: "primary",
},
},
};
var _hoisted_1$1 = { key: 1 };
function render$1(_ctx, _cache, $props, $setup, $data, $options) {
return (openBlock(), createElementBlock("button", {
class: normalizeClass($props.small ? 'button-' + $props.type + '--small' : 'button-' + $props.type + '--regular')
}, [
($props.iconsLeft)
? (openBlock(), createElementBlock("i", {
key: 0,
class: normalizeClass(["icon-left", $props.iconsLeft])
}, null, 2 /* CLASS */))
: createCommentVNode("v-if", true),
($props.title)
? (openBlock(), createElementBlock("span", _hoisted_1$1, toDisplayString($props.title), 1 /* TEXT */))
: createCommentVNode("v-if", true),
($props.iconsRight)
? (openBlock(), createElementBlock("i", {
key: 2,
class: normalizeClass(["icon-right", $props.iconsRight])
}, null, 2 /* CLASS */))
: createCommentVNode("v-if", true),
($props.icon)
? (openBlock(), createElementBlock("i", {
key: 3,
class: normalizeClass(["icon", $props.icon])
}, null, 2 /* CLASS */))
: createCommentVNode("v-if", true)
], 2 /* CLASS */))
}
script$1.render = render$1;
script$1.__file = "src/components/button/EnButton.vue";
var script = {
name: "EnCard",
props: {
title: String,
icon: String,
},
};
var _hoisted_1 = { class: "card-container" };
var _hoisted_2 = { class: "card-header" };
var _hoisted_3 = { class: "card-title" };
function render(_ctx, _cache, $props, $setup, $data, $options) {
return (openBlock(), createElementBlock("div", _hoisted_1, [
createElementVNode("div", _hoisted_2, [
createElementVNode("p", _hoisted_3, toDisplayString($props.title), 1 /* TEXT */),
($props.icon)
? (openBlock(), createElementBlock("i", {
key: 0,
class: normalizeClass(["icon", $props.icon])
}, null, 2 /* CLASS */))
: createCommentVNode("v-if", true)
]),
renderSlot(_ctx.$slots, "default", { class: "card-content" })
]))
}
script.render = render;
script.__file = "src/components/card/EnCard.vue";
// Importation de notre composant Vue
// Déclaration de la méthode d'installation utilisée via Vue.use(...)
function install(Vue) {
if (install.installed) { return; }
install.installed = true;
Vue.component("EnButton", script$1);
Vue.component("EnCard", script);
}
// Création du module à destionation Vue.use(...)
var plugin = {
install: install,
};
// Installation automatique si Vue est détecté (par exemple dans un navigation via la balise <script>)
var GlobalVue = null;
if (typeof window !== "undefined") {
GlobalVue = window.Vue;
} else if (typeof global !== "undefined") {
GlobalVue = global.Vue;
}
if (GlobalVue) {
GlobalVue.use(plugin);
}
// Exporter en tant que module (pour npm/webpack/etc.)
var wrapper = {
EnButton: script$1,
EnCard: script,
};
export { wrapper as default, install };