How to enchant items with commands in minecraft

Minecraft? Refer to this response from PPPERY for 1.13 and later. You can set some simple commands with control blocks, and let the players click the button of each control block so that they receive the enchanted elements. You can use the following command to give players enchanted objects (in this example, 1 diamond sword with Smite 2 and ................
................