0

target html with data binding

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <div class="row" v-for="test in tests">
     <div class="col-12">
        <router-link tag="a" :to="{ name:'test.index', params:{ id: test.id } }" >{{ test.name }}
        </router-link>
     </div>
     <div class="col-12">
         <img :src="(isTestURL && isPosted) ? '~/img/'+ 'testflow-img':'' + '.png'" class="img-fluid" />
      </div>
   </div>

Webpack mix config

mix.webpackConfig({
  resolve: {
    alias: {
      masonry: "masonry-layout",
      isotope: "isotope-layout",
      // custom aliases for easy reference
      src: path.resolve(__dirname, "resources/assets/"),
      assets: path.resolve(__dirname, "resources/assets/assets/"),
      img: path.resolve(__dirname, "resources/assets/assets/img/")
    }
  },

I can see the result of img/testflow-img.png, and no rendering. Like this example.com/img/testflow-img.png.

/images/testflow-img.png?1a2086faf6b06b086b9f10c5cc50eae2

Please follow any suggestions.

3
  • Is the image really there? Commented Mar 17, 2018 at 21:24
  • What about src attribute in rendered img? Can you inspect it via devTools? Commented Mar 17, 2018 at 21:46
  • Can you be more concise on what are you trying to ask? Commented Mar 18, 2018 at 2:17

1 Answer 1

1

With your webpack config, your codeline is not available to render to public\images directory.

Maybe you'd use v-if instead of Conditional operator like this

<div class="col-12" v-if = "isTestURL && isPosted">
     <img :src="~/img/testflow-img.png" class="img-fluid" />
</div>
Sign up to request clarification or add additional context in comments.

1 Comment

also, do resolve all img with importing assets, maybe it'll be work with you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.