nagm_star
252
6
Vue

How to count total row using vue js?

Posted 7 months ago by nagm_star

1- controller: public function index() { return Post::all()->paginate(6); }

2- vue js:

export default {
    data() {
        return {
         posts : [],    
        } 
    },
    methods: {
        postCounter(){
            axios.get("api/post/").then(({ data}) => (this.posts = data))
            return posts.lenght;
        },

    };

Please sign in or create an account to participate in this conversation.