Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

I'm trying to render Vue data in my summary.vue file.

Here is my HTML: (index.html)

<!DOCTYPE html>
<html>

<head lang="en">
  <meta charset="UTF-8">
  <link rel="stylesheet" href="./lib/bootstrap/css/bootstrap.min.css">
  <link rel="stylesheet" href="./lib/animate/animate.css">
</head>

<body>
  <app></app>
  <script src="./lib/jquery/jquery-2.2.4.min.js"></script>
  <script src="./lib/bootstrap/js/bootstrap.min.js"></script>
  <script src="./node_modules/vue/dist/vue.js"></script>
  <script src="./node_modules/vue/dist/vue.min.js"></script>
  <script src="./src/summary-components.js"></script>
  <script src="bundle.js"></script>
</body>

</html>

The 'app' tag is somehow connected with this file: (entry.js)

import Vue from 'vue';
import App from './Summary.vue';

new Vue({
  el: 'body',
  data: {
    message: 'test',
  },
  components: { App },
});

Which finally renders my .vue file 'Summary.vue'. But my data won't render to my http server, even trying to use script tags. (Summary.vue)

<div id="summarye">{{ message }}</div>

<script>

  new Vue({
    el: '#summarye',
    data: {
      message: "Vue JS Testing"
    }
  });

</script>

In my 'summary-components.js' file i've tried:

import Vue from 'vue';
import summary from './Summary.vue';

It's just not displaying.. can someone help me correctly import and get vue working?

share|improve this question
    
How are you getting started? If I were you I'd install vue-cli and start based off the code that gives you. It's very hard to follow what you're trying to do. A .vue file should look very different from that. – Bill Criswell Aug 2 at 0:13
    
I think it's working like this: (Entry.js -> index.html). The index.html is rendering the .vue template. – Greg H Aug 2 at 16:32
    
im pretty sure you need to use webpack to import .vue files. and if you are using webpack your css and js import should be done in your main.js or app.vue. i second what @BillCriswell said and use a vue-cli template – vbranden Aug 2 at 22:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.