framework7-vue
Version:
Build full featured iOS & Android apps using Framework7 & Vue
49 lines • 1.56 kB
JavaScript
import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass } from "vue";
const _hoisted_1 = ["target"];
const _hoisted_2 = {
key: 0,
class: "fab-label"
};
function render(_ctx, _cache) {
return _openBlock(), _createElementBlock("a", {
ref: "elRef",
class: _normalizeClass(_ctx.classes),
target: _ctx.target,
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
}, [_renderSlot(_ctx.$slots, "default"), _ctx.label ? (_openBlock(), _createElementBlock("span", _hoisted_2, _toDisplayString(_ctx.label), 1)) : _createCommentVNode("", true)], 10, _hoisted_1);
}
import { computed, ref } from 'vue';
import { classNames } from '../shared/utils.js';
import { colorClasses, colorProps } from '../shared/mixins.js';
import { useTooltip } from '../shared/use-tooltip.js';
export default {
name: 'f7-fab-button',
render,
props: {
fabClose: Boolean,
label: String,
target: String,
tooltip: String,
tooltipTrigger: String,
...colorProps
},
emits: ['click'],
setup(props, {
emit
}) {
const elRef = ref(null);
const onClick = e => {
emit('click', e);
};
useTooltip(elRef, props);
const classes = computed(() => classNames({
'fab-close': props.fabClose,
'fab-label-button': props.label
}, colorClasses(props)));
return {
classes,
onClick,
elRef
};
}
};