Japan is scrambling to ensure it has a future in an electric-car world. Toyota, the country’s largest automaker, pioneered gasoline-electric hybrids but has long been skeptical about consumers’ appetite for cars that run on batteries alone. Now, under pressure from foreign rivals like Tesla, the company says it is developing a batch of new electric models.