On-demand nanodevice with electrical and neuromorphic multifunction realized by local ion migration