Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Laravel 5.3和Vue 2_Javascript_Php_Laravel_Vue.js - Fatal编程技术网

Javascript Laravel 5.3和Vue 2

Javascript Laravel 5.3和Vue 2,javascript,php,laravel,vue.js,Javascript,Php,Laravel,Vue.js,我正在一个新的Laravel 5.3应用程序中使用Vue 2,我不知道如何以Laravel格式绑定URL 我从数据库中提取了一些配置行,我只想在它们上面循环显示数据,然后显示一个按钮,将您带到编辑屏幕。Vue不支持在URL中简单插入配置行的ID,因为我正在使用以下命令循环行: <tr v-for="config in data"> <td> <a href="/configurations/{{ config.id }}/edit">{{ conf

我正在一个新的Laravel 5.3应用程序中使用Vue 2,我不知道如何以Laravel格式绑定URL

我从数据库中提取了一些配置行,我只想在它们上面循环显示数据,然后显示一个按钮,将您带到编辑屏幕。Vue不支持在URL中简单插入配置行的ID,因为我正在使用以下命令循环行:

<tr v-for="config in data">
  <td>
    <a href="/configurations/{{ config.id }}/edit">{{ config.name }}</a>
  </td>
</tr>
我似乎无法获取要呈现的返回URL,它通常会抛出错误或抱怨我的var未定义


如何完成此(简单)任务?

解决方案是忽略计算URL函数,只需执行以下操作:

<a v-bind:href="url">
export default {
    mounted() {
        console.log('Component ready.')
    },
    data: function () {
        return {
            data: [config data array]
        }
    },
    computed: {
        url: function () {
            console.dir(this); // the whole component, not the row
            console.dir(this.id); // undefined
            console.dir(this.config); // undefined
            return "/configurations/" + this.config.id + "/edit" // throws error
        }
    }
}