If you cannot apportion the dividends based on where you lived at the time you received the dividends, then you can prorate them based on the number of months lived in each state.
For example, if you lived in one state for half the year, then half of the dividends would be apportioned to that state.