gpt4 book ai didi

javascript - 如何在 Laravel 5.6 中使用 vue-slider-component

转载 作者:行者123 更新时间:2023-11-30 20:23:26 25 4
gpt4 key购买 nike

我想在我的面板中添加一个 slider 。我已经安装了

npm install vue-slider-component --save

然后我创建了一个新组件并在 app.js

中注册

在我的 Slider.vue 组件中,我添加了 startet 模板

<template>
<div>
<vue-slider ref="slider" v-bind="options" v-model="value"></vue-slider>
<h3><small>Value: </small>{{ options.value }}</h3>
</div>
</template>

并导入了 vueSlider

<script>
import vueSlider from 'vue-slider-component'

export default {
components: {
vueSlider
},

data() {
return {
options: {
value: 5,
width: 'auto',
height: 6,
direction: 'horizontal',
dotSize: 16,
eventType: 'auto',
min: 5,
max: 100,
interval: 5,
show: true,
}
}
},
}
</script>

我正在获取 slider 。不幸的是,我无法滑动它并在开始时立即获得 maxValue。就像这张照片 enter image description here就是这样。无论我点击它什么都不做。当我想更改诸如更改 dotSize 之类的选项时,它也什么都不做。

我注意到当我打开控制台 (F12) 时它运行良好。

slider 包裹在 bootstrap 3 面板中。

我错过了什么?

更新 1:

我把值拉到了选项之外,现在我明白了:

enter image description here

最佳答案

您应该将选项直接放在 <vue-slider> 中作为属性。如果将它们添加到数据对象中,它可以是动态的。

<template>
<div>
<vue-slider
:value='value'
width='auto'
:height='6'
direction='horizontal'
:dotSize="16"
eventType='auto'
:min='5'
:max='100'
:interval='5'
:show='true'
/>
</div>
</template>

<script>
import vueSlider from 'vue-slider-component'

export default {
data: () => ({
value: 5
}),
components: {
vueSlider
}
}
</script>

关于javascript - 如何在 Laravel 5.6 中使用 vue-slider-component,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51204509/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com