我想选择一个具有jalai年格式的文件,并且为此使用'vue-jalali-moment'。
An unhandled exception of type 'System.AccessViolationException' occurred in System.Private.CoreLib.dll: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
但是我有一个问题,输出错误:
<template>
<div>
<select class="select-year" v-model="year" v-select2>
<option v-for="year in years" :value="year">
@{{ year | moment("jYYYY")}}
</option>
</select>
</div>
</template>
<script>
import select2 from 'select2';
export default {
name: "Profile",
data(){
return {
year: '',
}
},
mounted() {
$('.select-year').select2({
width: '100%',
minimumResultsForSearch: -1,
});
},
computed : {
years () {
const year = new Date().getFullYear()
return Array.from({length: year - 1900}, (value, index) => 1901 + index)
}
}
}
</script>
任何公历年份只能生成1348。
为什么不能正常工作?
答案 0 :(得分:1)
过滤器需要一个日期,然后您可以创建一个日期数组:
return Array.from({length: year - 1900}, (value, index) => new Date(1901 + index, 1, 1) )