So, in some music books, usually for piano, there are times when the treble-clef staff and the bass-clef staff have two notes connected via a diagonal line. How do I do that with Dorico?
Not sure exactly what you mean. Can you explain more, or post a screenshot?
3.1 does have custom lines that can attach from one notehead to another, if that’s what you’re looking for.
To add a follow-up question, how do I add a diagonal line between a whole-rest on the bass-clef staff and a note on the treble-clef staff?
Select the first note. Cmd/Ctrl-select the second note. Ensure that the start and end options at the top of the Lines panel are both set to “note” (which is the crotchet/quarter icon). Select the appropriate horizontal line from the panel.