“I think we love being the popular girl or boy at the dance right now,” said Eric Garcetti, the mayor of Los Angeles who considered his own presidential bid and has longstanding relationships with several candidates. Mr. Garcetti said that candidates have long come to California to raise money, but not to court voters.

Or, in school dance terms: “Historically, people want us to pay for the dance, but nobody wants to dance with us. Now, suddenly we’re able to hit the floor.”

Since Ms. Harris announced her candidacy with a large rally in Oakland, her campaign has put considerable effort into lining up endorsements from elected officials at every level up and down the state, including Gov. Gavin Newsom. She also continues to raise millions from her local supporters, holding half a dozen fund-raisers in the span of one July weekend.

Ian Sams, a spokesman for the Harris campaign, said that it views California as a huge opportunity for Ms. Harris, and a place where she does have an advantage.

But the campaign has also made clear that it needs to spend significant money to defend that advantage. If Ms. Harris were to lose on her home turf, it would most likely spell the end of her candidacy. This week, the campaign announced it had hired several new staff members to work in Los Angeles and Oakland.