Local pictures in vue JS code cannot be displayed (path error)

When displaying a local picture in the encapsulated function, you need to import the picture and then import it, otherwise an error will be reported

E.g:

import test from '../assets/location.png'
export default {
    
    
	mounted() {
    
    
		viewer.entities.add({
    
    
	    	position: Cesium.Cartesian3.fromDegrees(110.20, 34.55, 2.61),
			billboard: {
    
    
				image: test,
				height: 50,
				width: 50
			}
    	})
	}
}

Guess you like

Origin blog.csdn.net/qq_17627195/article/details/109224846