V, 18 1717 16 bytes
1 byte saved thanks to @nmjcman101 for using another way of outputting nothing if the input is 0
Àñé\é|hñÀñÙáé\é|ÀñÙá ñÒ-xxÀ«D Hexdump:
00000000: e95c e97c c0f1 d9e1 20f1 d22d 78c0 ab44 .\.|.... ..-x..D ###Explanation (outdated)
We first have a loop to check if the argument is 0. If so, the code below executes (|\ is written). Otherwise, nothing is written and the buffer is empty.
Àñ ñ " Argument times do: é\é| " Write |\ h " Exit loop by creating a breaking error Now that we got the top of the triangle, we need to create its body.
Àñ ñ " Argument times do: Ù " Duplicate line, the cursor comes down à<SPACE> " Append a space Now we got one extra line at the bottom of the buffer. This has to be replaced with -s.
Ó- " Replace every character with a - x " Delete the extra '-' This answer would be shorter if we could whatever we want for input 0
V, 14 13 bytes
é\é|ÀñÙá ñÒ-x