| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/framework7/node_modules/framework7-vue/components/ |
Upload File : |
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
function render(_ctx, _cache) {
return _openBlock(), _createElementBlock("div", {
ref: "elRef",
class: _normalizeClass(_ctx.classes)
}, [_renderSlot(_ctx.$slots, "default")], 2);
}
import { computed, ref, onMounted, onBeforeUnmount, watch } from 'vue';
import { classNames } from '../shared/utils.js';
import { colorClasses, colorProps } from '../shared/mixins.js';
import { f7ready, f7 } from '../shared/f7.js';
export default {
name: 'f7-list-index',
render,
props: {
init: {
type: Boolean,
default: true
},
listEl: [String, Object],
indexes: {
type: [String, Array],
default: 'auto'
},
scrollList: {
type: Boolean,
default: true
},
label: {
type: Boolean,
default: false
},
iosItemHeight: {
type: Number,
default: 14
},
mdItemHeight: {
type: Number,
default: 14
},
...colorProps
},
emits: ['listindex:select'],
setup(props, _ref) {
let {
emit
} = _ref;
let f7ListIndex = null;
const elRef = ref(null);
const update = () => {
if (!f7ListIndex) return;
f7ListIndex.update();
};
const scrollListToIndex = indexContent => {
if (!f7ListIndex) return;
f7ListIndex.scrollListToIndex(indexContent);
};
watch(() => props.indexes, newValue => {
if (!f7ListIndex) return;
f7ListIndex.params.indexes = newValue;
update();
});
onMounted(() => {
if (!props.init) return;
f7ready(() => {
f7ListIndex = f7.listIndex.create({
el: elRef.value,
listEl: props.listEl,
indexes: props.indexes,
iosItemHeight: props.iosItemHeight,
mdItemHeight: props.mdItemHeight,
scrollList: props.scrollList,
label: props.label,
on: {
select(index, itemContent, itemIndex) {
emit('listindex:select', itemContent, itemIndex);
}
}
});
});
});
onBeforeUnmount(() => {
if (f7ListIndex && f7ListIndex.destroy) {
f7ListIndex.destroy();
}
f7ListIndex = null;
});
const classes = computed(() => classNames('list-index', colorClasses(props)));
return {
elRef,
classes,
update,
scrollListToIndex
};
}
};