Just to be sure I understand you correctly, the screen on your Switch still shows items on the display, just will not show on the TV, correct?
This could be a few things, it could be the issue is with your dock, or the HDMI cable rather than your Switch. Charging and display output use the same port on the Switch, but the signals transmitting through the port are two different systems. Check a different HDMI cable first, and if that still doesn’t make a difference, see if you can get your hands on another dock, or even a USB C to HDMI adapter will likely do the job.
If that doesn’t work, then it may be an issue with the port on the Switch. There may be some loose, bent, or damaged pins. You can hav a look into the port with a flashlight to see if anything looks amiss. But if it’s damaged, that’s a repair which requires decent soldering skills. It’s not a super difficult repair if you’ve done soldering like that before, but it isn’t something I would recommend if you’ve never used a soldering iron before. Further, it could be an issue with the motherboard itself. Which is also fixable, but similarly would require specialized soldering skills.