How can I create a component that i will use in different pages? Like in react and vue. I want to use f7 core
1 Like
Thank you. So, how can I make such component from file?
import comp from '../pages/comp.f7.html'
Framework7.registerComponent(
'my-el',
(props, { $h }) => {
return () => comp
}
);
comp.f7.html:
<template>
<div>
oloffje
</div>
</template>
<script>
export default () => {
return $render;
}
</script>
i get error
app.js_+_268_modules:11589 Uncaught (in promise) TypeError: Cannot create property 'elm' on string 'function () {
return function ($ctx) {
var $ = $ctx.$;
var $h = $ctx.$h;
var $root = $ctx.$root;
var $f7 = $ctx.$f7;
var $f7route = $ctx.$f7route;
var $f7router = $ctx.$f7router;
var $theme = $ctx.$theme;
var $update = $ctx.$update;
var $store = $ctx.$store;
return $h(comp_f7_templateObject());
};
}'
at createElm (app.js_+_268_modules:11589)
at patch (app.js_+_268_modules:11793)
at eval (app.js_+_268_modules:12188)
oh i got it.
import comp from '../pages/comp.f7.html'
import comp from '../pages/comp.f7.html'
Framework7.registerComponent(
'my-el',
comp
);