Problems in the use of vue iview


<html>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

<head>

<!-- import Vue.js -->
<script src="https://vuejs.org/js/vue.min.js"></script>
<!-- import stylesheet -->
<link rel="stylesheet" href="https://unpkg.com/iview/dist/styles/iview.css">
<!-- import iView -->
<script src="https://unpkg.com/iview/dist/iview.min.js"></script>
</head>
<body>
<!---->
<template>
    <!--:columns;:data-->
    <Table :columns="columns1" :data="data1"></Table>
</template>
<script>
    export default {
        data () {
            return {
            //Columns1titlekeyK-V
                columns1: [
                    {
                        title: "Name",
                        key: "name"
                    },
                    {
                        title: "Age",
                        key: "age"
                    },
                    {
                        title: "Address",
                        key: "address"
                    }
                ],
                //key
                data1: [
                    {
                        name: "John Brown",
                        age: 18,
                        address: "New York No. 1 Lake Park",
                        date: "2016-10-03"
                    },
                    {
                        name: "Jim Green",
                        age: 24,
                        address: "London No. 1 Lake Park",
                        date: "2016-10-01"
                    },
                    {
                        name: "Joe Black",
                        age: 30,
                        address: "Sydney No. 1 Lake Park",
                        date: "2016-10-02"
                    },
                    {
                        name: "Jon Snow",
                        age: 26,
                        address: "Ottawa No. 2 Lake Park",
                        date: "2016-10-04"
                    }
                ]
            }
        }
    }
</script>
</body>
</html>


export default keeps reporting exception: Unexpected token export, excuse me how to use vue? in my project structure Just came into contact with this

Mar.25,2021

export default, is used in the vue, you introduced through script. This is the syntax of es6, which cannot be run directly in the browser without compilation. If you want html mode is the current way, the syntax format is

var app=new Vue({
      el:"-sharpapp",
      data:{
          message:'hello'
      },
      created:function(){

      },
      mounted:function(){

      },
      methods:{

      }
  })

and if you want to write it in export default mode, you can use vue-cli. You should be not familiar with js, not familiar with vue.


first of all, it is necessary to make it clear what exception is reported. In addition, the direction of the problem of how to use vue iview is a bit big, and it is not clear to say one or two sentences. It is recommended to take a good look at the official documents. To make good use of these things, it is not the same as writing a simple js script. I don't know why, but I know that I can achieve the effect I want. I need to study it carefully.


Why do you use export default? it's not a separate component. If you use it this way, you can use vue-cli to build a project.

Menu