vue 绑定下拉框的事件
XML/HTML Code复制内容到剪贴板
- <select v-model="selectType" @change="renderList($event)">
- <option v-for="(item,index) in typeOptions" :value="item.value" :selected="item.active">{{item.label}}</option>
- </select>
JavaScript Code复制内容到剪贴板
- <script>
- export default {
- data() {
- return {
- typeOptions: [{"label":"全部","value":0}], //搜索类型
- selectType:0, //选择的搜索类型
- dataList:[], //数据列表
- }
- },
- mounted: function() {
- this.init();
- },
- methods: {
- init() {
- /* 给搜索类型赋值 */
- let publishType = this.global.getPublishType();
- publishType.forEach((item,index) => {
- let arr = {
- "label":item,
- "value":index
- }
- this.typeOptions.push(arr);
- })
- console.log(this.typeOptions);
- },
- renderList(event) {
- console.log(this.selectType);
- },
- },
- }
- </script>
上一篇 vue echarts图表插件
下一篇 mint-ui Navbar