framework7-vue
Version:
Build full featured iOS & Android apps using Framework7 & Vue
47 lines • 1.64 kB
JavaScript
import { openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass } from "vue";
const _hoisted_1 = ["src"];
function render(_ctx, _cache) {
return _openBlock(), _createElementBlock("div", {
class: _normalizeClass(_ctx.classes),
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args))
}, [_ctx.image ? (_openBlock(), _createElementBlock("img", {
key: 0,
src: _ctx.image
}, null, 8, _hoisted_1)) : _createCommentVNode("", true), _ctx.deletable ? (_openBlock(), _createElementBlock("span", {
key: 1,
class: "messagebar-attachment-delete",
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onDeleteClick && _ctx.onDeleteClick(...args))
})) : _createCommentVNode("", true), _renderSlot(_ctx.$slots, "default")], 2);
}
import { computed } from 'vue';
import { classNames } from '../shared/utils.js';
import { colorClasses, colorProps } from '../shared/mixins.js';
export default {
name: 'f7-messagebar-attachment',
render,
props: {
image: String,
deletable: {
type: Boolean,
default: true
},
...colorProps
},
emits: ['attachment:click', 'attachment:delete'],
setup(props, {
emit
}) {
const onClick = event => {
emit('attachment:click', event);
};
const onDeleteClick = event => {
emit('attachment:delete', event);
};
const classes = computed(() => classNames('messagebar-attachment', colorClasses(props)));
return {
classes,
onClick,
onDeleteClick
};
}
};