Cloud-based vehicular networks is a new paradigm to improve the vehicular services through distributing computation tasks between remote clouds and local vehicular terminals. To further reduce the latency and the transmission cost of the computation offloading, we propose a cloud-based Mobile Edge Computing (MEC) offloading framework in vehicular networks. In the framework, efficient computation offloading strategies are designed through a contract theoretic approach. We obtain the optimal feasible contracts that maximize the benefit of the MEC service provider while enhancing the utilities of the vehicles. Furthermore, considering the resource limitation of the MEC server and the latency tolerance of the computation tasks, we propose a contract-based computation resource allocation scheme. Numerical results show that our proposed scheme greatly enhances the utility of the MEC service provider.