1、关于语法糖问题:
HTML如下:
<select v-model="sl"> <option :value="opt.value" v-for="opt in options">{{opt.text}}</option> </select>
如果不用语法糖如下即可:
<script> export default { data(){ return { options:[ { text: 'Runoob', value: 'www.runoob.com' }, { text: 'Google', value: 'www.google.com' }, { text: 'Taobao', value: 'www.taobao.com' } ] } } } </script>
用了setup的方法:
<script setup> import {ref} from "vue" const options = ref([ { text: 'Runoob', value: 'www.runoob.com' }, { text: 'Google', value: 'www.google.com' }, { text: 'Taobao', value: 'www.taobao.com' } ]) </script>
标签:www,VUE,Runoob,text,value,初学,遇见,com From: https://www.cnblogs.com/rainy0496/p/16978603.html