Computer-aided drug design can accelerate drug development and reduce the cost. This study proposes a targeted drug design method based on long short-term memory (LSTM) neural network and drug-target affinity. The method consists of de novo drug design and targeted drug design. First, the de novo drug design model learns molecular coding rules and broad chemical information through a large number of drug-like molecules training. Then, based on affinity score obtained from the drug-target interaction prediction model, the gradient of model parameters is clipped during training, so that the targeted drug design model can learn target specific information, efficiently designing drugs for a given target. In the experiment, the model can efficiently generate new drug-like molecules, and design more affinity drugs for 3CLpro of COVID-19 than the previous ones. In the docking structure, drug molecules designed have stable binding conformation and short atomic distances with amino acid residues of the given target.