D
D
danylo_kiz2017-03-23 21:01:22
JavaScript
danylo_kiz, 2017-03-23 21:01:22

Why does not see id?

I have js file in script.
HTML

<div>
    <script type="text/javascript">
      window.onload = function () {
      new Vue({
        		el: "#cheapestsites",
        		data: {
          			cheapsites: []
        		},
        		mounted(){
          			fetch("http://danya.loc/all.json").then(c => c.json()).then((data) => {
           				 this.cheapsites = data;
          			})
        		}
      		});
      		new Vue({
  				src: "./all.json",
  				el: "#one",
  				data: {
    	  			short: "As a rule, most people prefer to buy gadgets at an early stage of the product's life cycle, so it remains NEW longer. Others prefer to buy a bit later, waiting for any early problems to be worked out. And everyone agrees that buying the right to a significant improvement will make you feel at least a little bitter, because Apple does not know how to signal the product's upgrade when it is sold."
        		}
      		})
      }
    </script>

 	</div>

Why can't the element be seen? Although he stood at the very bottom of the code - there is no result, he put this code in the head, he does not see it at all.
2569f92e4e55448792255fcacfaf8497.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Arkhipov, 2017-03-24
@alphabear

src: "./all.json",
is that correct?

S
Stepanya, 2017-03-24
@Stepanya

https://jsfiddle.net/hko2y1z4/2/
You have a lot of bugs there, read https://vuejs.org/v2/guide/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question