pps
1
there are ajax/requests
inside component methods
like shown here
code
/* <template>
<div class="toolbar-inner segmented">
<a
href="#"
@click="handleSave"
class="button button-raised button-fill color-white margin-horizontal"
style="background: #0dcd5d"
>Save
</a>
</div>
</template> */
<script>
import {Component} from 'framework7'
export default class extends Component{
beforeCreate(){
this.handleSave = this.handleSave.bind(this);
}
mounted(){
// ...
}
handleSave(){
//....
this.$f7.request.promise({
// ....
})
}
}
</script>
Above code
logs:
TypeError: Cannot read property 'request' of undefined
any way to call ajax
inside component method 
You can use Request directly:
import { Component, Request } from 'framework7'
export default class extends Component{
beforeCreate(){
this.handleSave = this.handleSave.bind(this);
}
mounted(){
// ...
}
handleSave(){
//....
Request.promise({
// ....
})
}
}
1 Like
pps
3
Thank you. you are always helpful
how can we import
other components
like Toast
, dialog
, chips
, gauge
These must be used through this
. To access this propely you need to bind it to component. Try to bind it like so:
export default class extends Component{
constructor(...args) {
super(...args)
this.handleSave = this.handleSave.bind(this);
}