CopyPastor

Detecting plagiarism made easy.

Score: 0.8107437306956241; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-03-07
by Riddhi

Original Post

Original - Posted on 2018-03-03
by acdcjunior



            
Present in both answers; Present only in the new answer; Present only in the old answer;

In Vue regular setup, /assets is not served.
The image becomes `src="data:image/png;base64,iVrfSS0K..KK="` i.e string instead.
Using from within JavaScript:
To get the images from JS code,
use require('../assets.myImage.png') The path must be relative (as below). So your code would be:
var icon = L.icon({ iconUrl: require('./assets/img.png'), // was iconUrl: './assets/img.png', // ... });
For example, say you have the following folder structure:
- src +- assets - myImage.png +- components - MyComponent.vue
If you want to reference the image in MyComponent.vue, the path should be **../assets/myImage.png**
Here's a DEMO [CODESANDBOX][1] showing it in action.
[1]: https://codesandbox.io/s/610zwq4o6w?module=%2Fsrc%2Fcomponents%2FHelloWorld.vue
In a Vue regular setup, `/assets` is not served.
The images become `src="data:image/png;base64,iVBORw0K...YII="` strings, instead.
<br> # Using from within JavaScript: `require()`
To get the images from JS code, use **`require('../assets.myImage.png')`**. The path must be relative (see below).
So your code would be:
var icon = L.icon({ iconUrl: require('./assets/img.png'), // was iconUrl: './assets/img.png', // ... });
<br>
# Use relative path
For example, say you have the following folder structure:
- src +- assets - myImage.png +- components - MyComponent.vue
If you want to reference the image in `MyComponent.vue`, the path sould be `../assets/myImage.png`
<br>
Here's [**a DEMO CODESANDBOX**][1] showing it in action.

[1]: https://codesandbox.io/s/610zwq4o6w?module=%2Fsrc%2Fcomponents%2FHelloWorld.vue

        
Present in both answers; Present only in the new answer; Present only in the old answer;