Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
V
vue3-quasar-ts-study01
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hucy
vue3-quasar-ts-study01
Commits
042f7e41
Commit
042f7e41
authored
Nov 25, 2022
by
hucy
☘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:vue-i18n学习
parent
2b9b1213
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
72 additions
and
41 deletions
+72
-41
vue-i18n.ts
src/boot/vue-i18n.ts
+3
-2
UpLoader.vue
src/components/uploader-page/UpLoader.vue
+8
-6
enum.ts
src/config/enum.ts
+1
-0
en-US.ts
src/i18n/en-US.ts
+8
-2
index.ts
src/i18n/index.ts
+2
-0
ja.ts
src/i18n/ja.ts
+8
-2
ko.ts
src/i18n/ko.ts
+10
-0
zh-CN.ts
src/i18n/zh-CN.ts
+8
-2
zh-TW.ts
src/i18n/zh-TW.ts
+8
-2
TableStudy.vue
src/modules/page6/element/table-study/TableStudy.vue
+11
-25
index.ts
src/modules/page6/lang/index.ts
+2
-0
ko.ts
src/modules/page6/lang/ko.ts
+3
-0
No files found.
src/boot/vue-i18n.ts
View file @
042f7e41
import
{
boot
}
from
'quasar/wrappers'
;
import
{
boot
}
from
'quasar/wrappers'
;
import
{
createI18n
}
from
'vue-i18n'
;
import
{
createI18n
}
from
'vue-i18n'
;
import
messages
from
'src/i18n'
;
import
globalLang
from
'src/i18n'
;
export
default
boot
(({
app
})
=>
{
export
default
boot
(({
app
})
=>
{
// Create I18n instance
// Create I18n instance
...
@@ -8,9 +8,10 @@ export default boot(({ app }) => {
...
@@ -8,9 +8,10 @@ export default boot(({ app }) => {
// something vue-i18n options here ...
// something vue-i18n options here ...
legacy
:
false
,
// you must set `false`, to use Composition API
legacy
:
false
,
// you must set `false`, to use Composition API
locale
:
'zh-CN'
,
// set current locale
locale
:
'zh-CN'
,
// set current locale
formatFallbackMessages
:
true
,
// missingWarn: false,
// missingWarn: false,
// fallbackWarn: false,
// fallbackWarn: false,
messages
,
messages
:
globalLang
,
});
});
// Tell app to use the I18n instance
// Tell app to use the I18n instance
...
...
src/components/uploader-page/UpLoader.vue
View file @
042f7e41
...
@@ -3,11 +3,13 @@
...
@@ -3,11 +3,13 @@
-->
-->
<
script
setup
lang=
"ts"
>
<
script
setup
lang=
"ts"
>
import
{
ref
,
reactive
,
computed
,
nextTick
}
from
'vue'
;
import
{
ref
,
reactive
,
computed
,
nextTick
}
from
'vue'
;
import
{
useI18n
}
from
'vue-i18n'
;
import
{
useMessage
}
from
'src/common/hooks'
;
import
{
useMessage
}
from
'src/common/hooks'
;
import
{
getObjectURL
}
from
'./utils'
;
import
{
getObjectURL
}
from
'./utils'
;
var
XLSX
=
require
(
'xlsx'
);
var
XLSX
=
require
(
'xlsx'
);
const
{
t
}
=
useI18n
();
const
{
warn
}
=
useMessage
();
const
{
warn
}
=
useMessage
();
interface
IDetailProps
{
interface
IDetailProps
{
...
@@ -210,7 +212,7 @@ function closeViewDialog() {
...
@@ -210,7 +212,7 @@ function closeViewDialog() {
dense
dense
size=
"12px"
size=
"12px"
label=
"OK"
label=
"OK"
title=
"确认上传
"
:title=
"t('Confirm upload')
"
:style=
"
{
:style=
"
{
backgroundColor: props.dark ? props.bgColor : '#fff',
backgroundColor: props.dark ? props.bgColor : '#fff',
color: props.dark ? darkLight : props.bgColor,
color: props.dark ? darkLight : props.bgColor,
...
@@ -223,7 +225,7 @@ function closeViewDialog() {
...
@@ -223,7 +225,7 @@ function closeViewDialog() {
flat
flat
icon=
"bi-trash"
icon=
"bi-trash"
size=
"12px"
size=
"12px"
title=
"清除所有
"
:title=
"t('clear all')
"
:style=
"
{ color: props.dark ? props.bgColor : '#fff' }"
:style=
"
{ color: props.dark ? props.bgColor : '#fff' }"
@click="removeAll"
@click="removeAll"
/>
/>
...
@@ -243,8 +245,8 @@ function closeViewDialog() {
...
@@ -243,8 +245,8 @@ function closeViewDialog() {
push
push
icon=
"add"
icon=
"add"
size=
"12px"
size=
"12px"
title=
"选择文件
"
:title=
"t('Select file')
"
label=
"选择文件
"
:label=
"t('Select file')
"
:style=
"
{
:style=
"
{
backgroundColor: props.dark ? props.bgColor : '#fff',
backgroundColor: props.dark ? props.bgColor : '#fff',
color: props.dark ? darkLight : props.bgColor,
color: props.dark ? darkLight : props.bgColor,
...
@@ -276,7 +278,7 @@ function closeViewDialog() {
...
@@ -276,7 +278,7 @@ function closeViewDialog() {
flat
flat
dense
dense
size=
"12px"
size=
"12px"
title=
"预览
"
:title=
"t('preview')
"
icon=
"bi-eye"
icon=
"bi-eye"
:style=
"
{ color: props.bgColor }"
:style=
"
{ color: props.bgColor }"
@click="onView(item)"
@click="onView(item)"
...
@@ -287,7 +289,7 @@ function closeViewDialog() {
...
@@ -287,7 +289,7 @@ function closeViewDialog() {
flat
flat
dense
dense
size=
"12px"
size=
"12px"
title=
"从列表移除
"
:title=
"t('remove from list')
"
icon=
"bi-x-circle"
icon=
"bi-x-circle"
:style=
"
{ color: props.bgColor }"
:style=
"
{ color: props.bgColor }"
@click="removeItem(index)"
@click="removeItem(index)"
...
...
src/config/enum.ts
View file @
042f7e41
...
@@ -3,4 +3,5 @@ export const Langs = [
...
@@ -3,4 +3,5 @@ export const Langs = [
{
label
:
'繁體中文'
,
value
:
'zh-TW'
},
{
label
:
'繁體中文'
,
value
:
'zh-TW'
},
{
label
:
'English'
,
value
:
'en-US'
},
{
label
:
'English'
,
value
:
'en-US'
},
{
label
:
'日本'
,
value
:
'ja'
},
{
label
:
'日本'
,
value
:
'ja'
},
{
label
:
'韩国'
,
value
:
'ko'
},
];
];
src/i18n/en-US.ts
View file @
042f7e41
export
default
{
export
default
{
hello
:
'hello!'
,
ok
:
'ok'
,
'World Cup'
:
'World Cup'
,
'Select file'
:
'Select file'
,
preview
:
'preview'
,
'Upload files'
:
'Upload files'
,
'No file selected'
:
'No file selected'
,
'Confirm upload'
:
'Confirm upload'
,
'clear all'
:
'clear all'
,
'remove from list'
:
'remove from list'
,
};
};
src/i18n/index.ts
View file @
042f7e41
...
@@ -2,10 +2,12 @@ import zhCN from './zh-CN';
...
@@ -2,10 +2,12 @@ import zhCN from './zh-CN';
import
zhTW
from
'./zh-TW'
;
import
zhTW
from
'./zh-TW'
;
import
enUS
from
'./en-US'
;
import
enUS
from
'./en-US'
;
import
ja
from
'./ja'
;
import
ja
from
'./ja'
;
import
ko
from
'./ko'
;
export
default
{
export
default
{
'zh-CN'
:
zhCN
,
'zh-CN'
:
zhCN
,
'zh-TW'
:
zhTW
,
'zh-TW'
:
zhTW
,
'en-US'
:
enUS
,
'en-US'
:
enUS
,
ja
:
ja
,
ja
:
ja
,
ko
:
ko
,
};
};
src/i18n/ja.ts
View file @
042f7e41
export
default
{
export
default
{
hello
:
'こんにちは!'
,
ok
:
'ok'
,
'World Cup'
:
'ワールドカップ'
,
'Select file'
:
'ファイルを選択'
,
preview
:
'プレビュー'
,
'Upload files'
:
'ファイルをアップロードする'
,
'No file selected'
:
'ファイルが選択されていません'
,
'Confirm upload'
:
'アップロードを確認'
,
'clear all'
:
'すべてクリア'
,
'remove from list'
:
'リストから削除する'
,
};
};
src/i18n/ko.ts
0 → 100644
View file @
042f7e41
export
default
{
ok
:
'ok'
,
'Select file'
:
'파일 선택'
,
preview
:
'시사'
,
'Upload files'
:
'파일 올리기'
,
'No file selected'
:
'선택한 파일이 없습니다'
,
'Confirm upload'
:
'업로드 확인'
,
'clear all'
:
'모두 지우기'
,
'remove from list'
:
'목록에서 제거하다'
,
};
src/i18n/zh-CN.ts
View file @
042f7e41
export
default
{
export
default
{
hello
:
'你好!'
,
ok
:
'ok'
,
'World Cup'
:
'世界杯'
,
'Select file'
:
'选择文件'
,
preview
:
'预览'
,
'Upload files'
:
'上传文件'
,
'No file selected'
:
'未选择任何文件'
,
'Confirm upload'
:
'确认上传'
,
'clear all'
:
'清除所有'
,
'remove from list'
:
'从列表移除'
,
};
};
src/i18n/zh-TW.ts
View file @
042f7e41
export
default
{
export
default
{
hello
:
'你好!'
,
ok
:
'ok'
,
'World Cup'
:
'世界盃'
,
'Select file'
:
'選擇文件'
,
preview
:
'預覽'
,
'Upload files'
:
'上傳文件'
,
'No file selected'
:
'未選擇任何文件'
,
'Confirm upload'
:
'確認上傳'
,
'clear all'
:
'清除所有'
,
'remove from list'
:
'從列表移除'
,
};
};
src/modules/page6/element/table-study/TableStudy.vue
View file @
042f7e41
...
@@ -12,9 +12,8 @@ import { read, utils, writeFile } from 'xlsx';
...
@@ -12,9 +12,8 @@ import { read, utils, writeFile } from 'xlsx';
// var XLSX = require('xlsx');
// var XLSX = require('xlsx');
import
lang
from
'../../lang'
;
import
lang
from
'../../lang'
;
console
.
log
(
'lang >>>>'
,
lang
);
const
{
t
}
=
useI18n
({});
const
{
t
}
=
useI18n
({
messages
:
lang
});
const
{
warn
}
=
useMessage
();
const
{
warn
}
=
useMessage
();
const
excelTypeList
=
[
'xlsx'
,
'xls'
];
const
excelTypeList
=
[
'xlsx'
,
'xls'
];
...
@@ -52,7 +51,10 @@ const columns: any[] = [
...
@@ -52,7 +51,10 @@ const columns: any[] = [
},
},
];
];
const
uploadXlsxMsg
=
ref
(
'未选择任何文件'
);
console
.
log
(
'lll'
,
t
(
'No file selected'
));
const
hasUploadXlsxMsg
=
ref
(
false
);
const
uploadXlsxMsg
=
ref
(
t
(
'No file selected'
));
const
state
=
reactive
({
const
state
=
reactive
({
rows
:
[
rows
:
[
...
@@ -135,6 +137,7 @@ function uploadXlsx() {
...
@@ -135,6 +137,7 @@ function uploadXlsx() {
if
(
excelTypeList
.
includes
(
fileType
))
{
if
(
excelTypeList
.
includes
(
fileType
))
{
uploadXlsxMsg
.
value
=
`
${
file
.
name
}
${
size
}${
unit
}
`
;
uploadXlsxMsg
.
value
=
`
${
file
.
name
}
${
size
}${
unit
}
`
;
hasUploadXlsxMsg
.
value
=
true
;
const
data
=
await
file
.
arrayBuffer
();
const
data
=
await
file
.
arrayBuffer
();
const
wb
=
read
(
data
);
const
wb
=
read
(
data
);
const
ws
=
wb
.
Sheets
[
wb
.
SheetNames
[
0
]];
const
ws
=
wb
.
Sheets
[
wb
.
SheetNames
[
0
]];
...
@@ -211,31 +214,13 @@ function exportTableData() {
...
@@ -211,31 +214,13 @@ function exportTableData() {
/>
/>
</div>
</div>
<div>
<q-btn
:label=
"t('hello1')"
square
push
style=
"background: #4aacc5; color: white"
/>
</div>
<div>
<q-btn
:label=
"t('World Cup')"
square
push
style=
"background: #4aacc5; color: white"
/>
</div>
<div>
<div>
<q-table
:rows=
"state.rows"
:columns=
"columns"
row-key=
"name"
/>
<q-table
:rows=
"state.rows"
:columns=
"columns"
row-key=
"name"
/>
</div>
</div>
</div>
</div>
<div
class=
"upload-box"
>
<div
class=
"upload-box"
>
<div
style=
"width: 400px; height: 232px"
class=
"q-my-md"
>
<div
style=
"width: 400px; height: 232px"
class=
"q-my-md"
>
<!-- FAD4D4 -->
<com-up-loader
bg-color=
"#FAD4D4"
dark
multiple
@
on-ok=
"uploadOk"
/>
<com-up-loader
bg-color=
"#d9d9f3"
dark
multiple
@
on-ok=
"uploadOk"
/>
</div>
</div>
<div
style=
"width: 400px; height: 232px"
class=
"q-my-md"
>
<div
style=
"width: 400px; height: 232px"
class=
"q-my-md"
>
<com-up-loader
bg-color=
"#A4BE7B"
multiple
@
on-ok=
"uploadOk"
/>
<com-up-loader
bg-color=
"#A4BE7B"
multiple
@
on-ok=
"uploadOk"
/>
...
@@ -244,7 +229,7 @@ function exportTableData() {
...
@@ -244,7 +229,7 @@ function exportTableData() {
<div
class=
"upload-xlsx-box"
>
<div
class=
"upload-xlsx-box"
>
<div>
<div>
<q-btn
<q-btn
label=
"上传文件
"
:label=
"t('Upload files')
"
square
square
push
push
:icon=
"ICON.upload"
:icon=
"ICON.upload"
...
@@ -253,8 +238,9 @@ function exportTableData() {
...
@@ -253,8 +238,9 @@ function exportTableData() {
/>
/>
</div>
</div>
<div>
<div>
<q-chip
:ripple=
"false"
square
<q-chip
:ripple=
"false"
square
>
><span
v-html=
"uploadXlsxMsg"
></span>
<span
v-if=
"!hasUploadXlsxMsg"
>
{{
t
(
'No file selected'
)
}}
</span>
<span
v-else
v-html=
"uploadXlsxMsg"
></span>
</q-chip>
</q-chip>
</div>
</div>
</div>
</div>
...
...
src/modules/page6/lang/index.ts
View file @
042f7e41
...
@@ -2,10 +2,12 @@ import zhCN from './zh-CN';
...
@@ -2,10 +2,12 @@ import zhCN from './zh-CN';
import
zhTW
from
'./zh-TW'
;
import
zhTW
from
'./zh-TW'
;
import
enUS
from
'./en-US'
;
import
enUS
from
'./en-US'
;
import
ja
from
'./ja'
;
import
ja
from
'./ja'
;
import
ko
from
'./ko'
;
export
default
{
export
default
{
'zh-CN'
:
zhCN
,
'zh-CN'
:
zhCN
,
'zh-TW'
:
zhTW
,
'zh-TW'
:
zhTW
,
'en-US'
:
enUS
,
'en-US'
:
enUS
,
ja
:
ja
,
ja
:
ja
,
ko
:
ko
,
};
};
src/modules/page6/lang/ko.ts
0 → 100644
View file @
042f7e41
export
default
{
hello
:
'안녕하십니까'
,
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment