laravel - 如何更改 vuejs laravel 中的选项标签
问题描述
我正在学习 VUE,无法弄清楚如何更改选择中的选项标签。
我有这个从控制器发送到查看的数组。
previewData
0=>[
'label' => 'abc',
'width' => 123,
'height' => 432
]
1=>[
'label' => 'abc',
'width' => 123,
'height' => 432
]
这是我的代码
import vSelect from 'vue-select';
export default {
props : [
'preview_size',
],
data : () => {
return {
previewData : [],
assetData : {id: 0, name: '', parent_id: '', nameError: '', maintain_version: true},
selectedItem : {},
selectedPreview : null,
scalePreview : false,
selectedSection : {},
selectedBlocks : {},
versionchange : null,
previousVersion : null,
previousSections: [],
losses : [],
previewLink : '',
instantDownload : false,
tags : [],
selectedTags : [],
selectedElements: [],
};
},
created() {
this.previewData = JSON.parse(this.preview_size);
components: {
uuid,
vSelect,
});
<v-select
class='form-control col-md-8'
v-model='selectedPreview'
:options='previewData'
data-error='Please correct this field.'
/>
我无法弄清楚如何更改它显示的标签
<option>abc</option>
<option>abc</option>
我想这样展示
<option>abc 123 x 432</option>
<option>abc 123 x 432</option>
我试过的
<v-select
class='form-control col-md-8'
v-model='selectedPreview'
:options='previewData'
data-error='Please correct this field.'
<template slot="option" slot-scope="option">
<span :class="option.label"></span>
{{ option.width }}px x {{ option.height }}px {{ option.label }}
</template>
/>
但仍然只显示标签。
解决方案
推荐阅读
- elixir - Elixir 无法在定义它的同一文件中创建结构
- javascript - Chart.js 工具提示不显示
- python - Python,OpenCV 无法关闭最后一个窗口
- c# - 如何在 Winforms C# 中删除选定的控件?
- linux - 在c中识别虚拟网络接口
- android - 生成签名的 APK 时出错
- digital-signature - 如何在 javacard 小程序上签名并将签名返回给主机应用程序
- jquery - jQuery.validate() 错误:未捕获的 TypeError:无法读取未定义的属性“设置”
- amazon-web-services - 使用 Mandrill 邮件服务的队列 (SQS)
- php - 回声重复变量循环php