Comments (4)
@hwyeeee 麻烦提供下完整的代码片段 包括 YearArr的数据 getDateYear的返回值样例。
from pd-select.
<template>
<div id="app">
<button @click="getTime">获取时间
<br>
<input type="text" v-model="date">
<br>
<button @click="after">重置时间
<pd-select-box style="position: fixed;bottom: 0;width: 100%">
<pd-select-item ref="year" :listData="yearArr" v-model="year" type="cycle">
<pd-select-item ref="month" :listData="monthArr" v-model="month" type="cycle">
<pd-select-item ref="day" :listData="dayArr" v-model="day" type="cycle">
<pd-select-item ref="hour" :listData="hourArr" v-model="hour" type="cycle">
</pd-select-box>
</div>
</template>
<script> export default { name: 'app', data () { return { yearArr: Array.from({length: 31}, (value, index) => index + 2000), monthArr: Array.from({length: 12}, (value, index) => index + 1), dayArr: Array.from({length: 31}, (value, index) => index + 1), hourArr: Array.from({length: 24}, (value, index) => index), year: '', month: '', day: '', hour: '', date: '' } }, mounted(){ setTimeout(()=>{ this.after() },300) }, methods: { getTime () { this.date = this.year + '-' + this.month + '-' + this.day + ' ' + this.hour }, after () { let curDate = new Date() this.year = curDate.getFullYear() this.month = (curDate.getMonth() + 1) this.day = curDate.getDate() this.hour = curDate.getHours() this.$refs.year.init() this.$refs.month.init() this.$refs.day.init() this.$refs.hour.init() } } } </script>
@k186 ,测试时候的代码
from pd-select.
已经修复 安装最新版本就可以了
from pd-select.
thanks
from pd-select.
Related Issues (12)
- There's a npm missing from the package.json HOT 1
- 轮盘值在拨动时,取值不准确问题 HOT 8
- package.json的main路径写错了 HOT 1
- 初始化值有问题
- 请问有事件可以监听动画停止吗 我加个按钮点快的时候就拿不到值了 HOT 3
- 首次加载滚动框留白 HOT 1
- 当前初始值不存在,请检查后listData范围!! HOT 3
- type为line时显示出现问题
- 使用组件出错 HOT 3
- v-model 值改变时,dom选中项未改变 HOT 21
- 事件绑定错误 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pd-select.