我想用Vue js中的另一个变量初始化一个变量 在这里,我想用'select'变量
初始化'multiple'变量 <div id="myapp">
<select v-model="select">
<option selected>A</option>
<option>B</option>
<option>C</option>
</select>
<span>Selected {{select}}</span>
<hr>
<select v-model="multiple" multiple>
<option selected>A</option>
<option>B</option>
<option>C</option>
</select>
<span>Multiple Selected :{{ multiple | JSON}}</span>
</div>
<script src="https://cdn.jsdelivr.net/vue/latest/vue.js"></script>
<script>
var vm=new Vue({
el:'#myapp',
data:{
select:'B',
multiple:select
}
})
</script>`
我在这里收到如下错误: 未捕获的ReferenceError:未定义选择
答案 0 :(得分:1)
您无法在SELECT `messages`.*, `user`.`firstname`, `user`.`lastname`, `user`.`organisation_name`, `user`.`type`, `user_info`.`profile_picture`, `user_info`.`logo`, `user`.`email`
FROM (`messages`) JOIN
`user`
ON `user`.`user_id` = `messages`.`from_id` JOIN
`user_info`
ON `user_info`.`uid` = `messages`.`from_id`
WHERE `messages`.`from_id` = '4' AND
`messages`.`to_id` = '24572' AND
`messages`.`time_sent` <= '2016-06-23 12:41:47' OR
`messages`.`from_id` = '24572' AND
`messages`.`to_id` = '4' AND
`messages`.`time_sent` <= '2016-06-23 12:41:47'
ORDER BY `messages`.`msg_id` DESC
方法中访问此类数据属性。
如果你想这样做(虽然在这个例子中似乎有点无用),你必须在外面定义一个变量,然后在data()
中引用它
data()