这篇要做的:把订单日期改用 jQuery UI DatePicker + vue component !
把 jQuery UI DatePicker 放在这个 component 内 !
const jquery_ui_date_picker = {
template: `
<input type="text"
v-bind:id="id"
v-model="dom_value" />
`,
props: {
id: String,
date_format: String,
modelValue: String,
},
setup(props, {emit}) {
let dom = null;
onMounted(() => {
dom = $("#"+ props.id);
dom.datepicker({
dateFormat: props.date_format || "yy-mm-dd",
onClose : function (dateText, inst) {
dom_value.value = dateText;
}
});
})
const dom_value = computed({
get: () => {
return props.modelValue?.split('T')[0];
},
set: (v) => {
if (v === "")
{
v = null;
}
emit('update:modelValue', v);
},
});
return {
dom_value,
}
},
}
引用上述 component
原本 vue 指定 mount 的地方上面加上 js script 的引用
</script>
<script src="/lib/jquery-ui-select-menu.js?20210608001"></script>
<script src="/lib/jquery-ui-date-picker.js?20210608001"></script>
<script>
app.component("jquery-ui-select-menu", jquery_ui_select_menu);
app.component("jquery-ui-date-picker", jquery_ui_date_picker);
const vm = app.mount('#app');
</script>
把订单日期改为以下语法
<jquery-ui-date-picker
v-model="vue_model.OrderDate"
v-bind:id="'OrderDate'"
v-bind:date_format="'yy-mm-dd'"
></jquery-ui-date-picker>
vue
const calculate = function () {
CustomFetch.PostJson(calculate_url, vue_model.value)
.then(data => vue_model.value = data);
}
const submit_form = function() {
CustomFetch.PostJson(post_url, vue_model.value)
.then(data => vue_model.value = data);
}
这篇先到这里,下一篇来看看 下拉选单连动 + jQuery UI Selectmenu !
<<: Day 22:专案05 - KKBOX风云榜01 | AJAX
>>: Day25-Kaggle Titanic迈进前5% part(2)
checkbox(核取方块) 核取方块也就是我们所说的复选题 以下为例子,大家也可以跟着做做看 te...
今天就直接来设定一下MongoDB以及Spring专案的架构,昨天有提到MongoDB是使用Dock...
在 Kubernetes 中元件间的通讯都是藉由 API Server 通讯,而 API Serve...
前言 打给猴~ 第一天的开始不免俗先来废话一段以及简述一下未来三十天的方向。 时间飞快又经一年的时间...
0x1 前言 昨天订单回覆有个 Web ATM URL 好吸引我,想去瞧一下里面长什麽样, 今天也把...