date week range
v2.0.3
Versi V1 didasarkan pada elemen-UI 2.x, yang dapat digunakan oleh elemen-UI 2.x;
Versi V2 didasarkan pada elemen-plus. Ini dapat digunakan oleh elemen-plus;
Versi Portal V1
Versi V1, Versi V2
Itu tidak akan secara otomatis menyuntikkan CSS dan perlu diperkenalkan secara manual untuk menghindari cakupan gaya; jika gaya elemen-plus diperkenalkan secara global, tidak ada pengantar tambahan!
Mode Pengembangan Lokal, menggunakan modul ESM secara default, jika Anda perlu bergegas ke ES5, silakan merujuk ke:
// 在 vue-cli 将指定的 node_modules 模块转义成es5:
// vue.config.js
module . exports = {
// 省略代码
transpileDependencies : [ 'date-week-range' , 'element-plus' ]
}
Memasang
npm install date-week-range@next --save
yarn add date-week-range@next --save
daftar
import DateWeekRange from 'date-week-range'
import { createApp } from 'vue'
// 引入样式;如果全局引入了 element-plus 样式,则无需再次引入
// 全局引入 element-plus 样式
// import 'element-plus/dist/index.css'
// 或引入
// import 'element-plus/theme-chalk/el-icon.css'
// import 'element-plus/theme-chalk/el-date-picker.css'
// import 'element-plus/theme-chalk/el-var.css';
// 或引入
// import 'date-week-range/index.css'
const app = createApp ( {
/* ... */
} )
app . use ( DateWeekRange )
< template >
< DateWeekRange v-model = "test" > </ DateWeekRange >
</ template >
< script >
import { DateWeekRange } from 'date-week-range'
// 注意要引入样式!引入方式参考上面
export default {
data ( ) {
return {
test : ''
}
} ,
components : {
DateWeekRange
}
}
< / script>
<!-- 引入样式。如果全局引入了element-plus 样式,则不需额外引入 -->
<!-- 全局引入 element-plus 样式 -->
< link type =" text/css " href =" https://unpkg.com/element-plus/lib/theme-chalk/index.css " >
<!-- 或者额外引入 -->
< link type =" text/css " href =" https://unpkg.com/element-plus/lib/theme-chalk/el-icon.css " >
< link type =" text/css " href =" https://unpkg.com/element-plus/lib/theme-chalk/el-date-picker.css " >
< script src =" https://unpkg.com/date-week-range@next " > </ script >
< body >
< div id =" app " >
< date-week-range v-model =" test " > </ date-week-range >
</ div >
</ body >
< script >
const app = window . Vue . createApp ( {
data ( ) {
return {
test : ''
}
}
} )
app . use ( window . DateWeekRange )
app . mount ( "#app" )
</ script >
Gunakan default Cina
Pendaftaran Global
import { createApp } from 'vue'
import App from './App.vue'
import DateWeekRange from 'date-week-range'
import 'dayjs/locale/zh-cn'
import locale from 'element-plus/lib/locale/lang/zh-cn'
const app = createApp ( App )
app . use ( DateWeekRange , { locale } )
app . mount ( '#app' )
export default app
Saat mendaftar
< script >
import { DateWeekRange , locale } from 'date-week-range'
import lang from 'element-plus/lib/locale/lang/zh-cn'
import 'dayjs/locale/zh-cn'
locale(lang)
/* 省略… */
</ script >
Plug-in ini dikembangkan berdasarkan komponen EL-DATE-PICKE dalam kerangka elemen-plus, dan dokumentasinya konsisten dengan komponen EL-Date-Picker Type = "Daterant".