创建的挂钩中出现错误:“ ReferenceError:未定义ID”

时间:2019-04-01 04:26:29

标签: laravel vuejs2

<script>
    export default {
        props:['postId'],
        data() {
            return {
                tasks: [],
                id: ''
            }
        },
        created() {
            this.id = this.postId,
            axios.get('./api/task/' + id) //didn't return result
                .then(response => {
                    this.tasks = response.data
                });
        },
        methods: {
            updateId: function (updatedId) {
                this.id = updatedId;
            }
        },
        mounted() {
            console.log('Component mounted.')
        }
    }
</script>

API路线

Route::resource('task','Post2Controller');

我正在尝试获取特定的数据行。

错误:

  

app.js:38012 [Vue警告]:创建的挂钩中出现错误:“ ReferenceError:未定义ID”

0 个答案:

没有答案