(Example 3 Given $f(x)=\log _{a}\left(2-a^{x}\right)$ is a decreasing function of $x$ on $[0,1]$, find the range of real number $a$.
When $a>1$, the function $t=2-a^{x}>0$ is a decreasing function. Given that $y=\log _{a}\left(2-a^{x}\right)$ is a decreasing function of $x$ on $[0,1]$, we know that $y=\log _{a} t$ is an increasing function, so $a>1$. For $x \in[0,1]$, $2-a^{x} \geqslant 2-$ $a>0$, which implies $a0$ is an increasing function, and given that $y=\log _{a}\left(2-a^{x}\right)$ is a decreasing function of $x$ on $[0,1]$, we know that $y=\log _{a} t$ is a decreasing function. Therefore, $0<a<1$. For $2-a^{x}>0$, it follows that $0<a<1$.
In summary, $0<a<1$ or $1<a<2$.