Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/275.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
Php 在vuejs中设置laravel变量_Php_Laravel_Vue.js_Vuejs2 - Fatal编程技术网

Php 在vuejs中设置laravel变量

Php 在vuejs中设置laravel变量,php,laravel,vue.js,vuejs2,Php,Laravel,Vue.js,Vuejs2,嗨,我有这个laravel php刀片代码 <tr v-for='line , id in edited_lines'> <td> @include( 'treats.create_search_and_select', [ 'search_and_select' => 'user_id[]', 'value' => nul

嗨,我有这个laravel php刀片代码

<tr v-for='line , id in edited_lines'>
    <td>
        @include(
            'treats.create_search_and_select',
            [
                'search_and_select' => 'user_id[]',
                'value' =>  null,
                'hidden_id' => null,
                'type' => 'all_type_of_accounts',
                'required' => 'required',
                'language' => 'account',
                'hint' => null,
                'policy' => null,
                'show_type' => 'blank',
                'rank' => null,
            ]
        )
    </td>
</tr>
所以我试过这个

 'value' =>  "@{{line}}",
还有这个

'value' =>  "{{line}}",
没有一个是因为热爱工作。。 那么,如何设置值或隐藏的id from value from
非常感谢

从Laravel到Vue共享(全局)变量的主要方法是:

  • 通过窗口将状态变量传递给Vue应用程序(例如,用于用户信息)
  • 将属性传递给组件
但是,无法将您的
hidden_id
变量从Vue共享到Blade。我建议您根据代码片段和表行的内容制作一个组件,并在Vue中处理所有内容,而不是一半在Vue中,一半在blade中

使用状态变量,可以执行以下操作:

<html>
<head>
    <script type="application/javascript">
        window.state = {
            my_js_var: '{{ $myPhpVar }}',
        };
    </script>
</head>
<body>

</body>
</html>

你不能这么做。PHP在服务器端编译/运行,而Vue在客户端(浏览器)编译/运行。
<html>
<head>
    <script type="application/javascript">
        window.state = {
            my_js_var: '{{ $myPhpVar }}',
        };
    </script>
</head>
<body>

</body>
</html>