tool-select.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <template>
  2. <div class="module-box link-select">
  3. <div class="module-box__title">
  4. <label class="module-box__label">{{title}}</label>
  5. </div>
  6. <el-select class="link-select__select" :popper-append-to-body="false" v-model="selsectValue" placeholder="请选择跳转到的页面" @change="selectChanged">
  7. <el-option
  8. v-for="item in options"
  9. :key="item.value"
  10. :label="item.label"
  11. :value="item.value">
  12. </el-option>
  13. </el-select>
  14. </div>
  15. </template>
  16. <script>
  17. export default {
  18. name: 'tool-select',
  19. data () {
  20. return {
  21. selsectValue: ''
  22. }
  23. },
  24. props: {
  25. title: {
  26. type: String,
  27. default: '标题'
  28. },
  29. linkValue: {
  30. type: String,
  31. default: ''
  32. },
  33. options: {
  34. type: Array,
  35. default: () => []
  36. }
  37. },
  38. mounted () {
  39. this.selsectValue = this.linkValue // props 不能直接修改
  40. },
  41. methods: {
  42. selectChanged (value) {
  43. this.$emit('update:linkValue', value)
  44. }
  45. }
  46. }
  47. </script>
  48. <style lang="scss" scoped>
  49. .link-select{
  50. &__select{
  51. width: 100%;
  52. }
  53. }
  54. </style>