Generally submit a written application for resignation. If you need to leave early, you can negotiate with the company, and the company may not deduct your salary.
According to the Labor Contract Law, if a worker intends to resign, he needs to apply to the employer for resignation 30 days in advance, so as to reserve some time for the employer to recruit and train new employees. If you leave your job early, it will have a certain impact on the employer. So under normal circumstances, if you leave your job early, the employer will deduct your salary.