Edit note: I've adopt an advice to use $\oplus$, which is equivalent to $+$ for vector. And I do distinguish it from that because a scalar, in normal case, can't be added to a vector.(special case)
Both $\hat i$ and $\hat j$ are unit vectors. Assume that: $$\vec A = A_{x} \hat{i} \oplus A_{y} \hat{j}\\ \vec B = B_{x} \hat{i} \oplus B_{y} \hat{j}\\$$
One of my book computes the dot product like this: $$Since \quad \hat i \cdot \hat i = \hat j \cdot \hat j = 1 \quad and \quad \hat i \cdot \hat j = 0\\ \begin{align} \vec A \cdot \vec B &=(A_{x} \hat{i} \oplus A_{y} \hat{j}) \cdot (B_{x} \hat{i} \oplus B_{y} \hat{j})\\ &= A_{x} \hat i \cdot B_{x} \hat i + A_{x} \hat i \cdot B_{y} \hat j\\ &\quad + A_{y}\hat j\cdot B_{x}\hat i+A_{y}\hat j\cdot B_{y}\hat j\\ &= A_{x} B_{x} + 0\\ &\quad + 0 + A_{y} B_{y}\\ &= A_{x} B_{x} + A_{y} B_{y}\\ \end{align}$$
Why the $\oplus$, which is for vector, in the parentheses become the $+$, which is for scalar? Is this related to axioms of vector space?
Edit2: Definition from my book:
We define $\vec A \cdot \vec B$ to be the magnitude of $\vec A$ multiplied by the component of $\vec B$ in the direction of $\vec A$. Expressed as an equation,
$\vec A \cdot \vec B = AB\cos{\phi} = |\vec A||\vec B|\cos{\phi}$
As above, expand the dot product for the two parentheses, and some terms become $0$,
$\vec A \cdot \vec B = A_{x}B_{x} + A_{y}B_{y} + A_{z}B_{z}$
