mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 18:14:13 +00:00
[Build] revert site to webpack config (#3747)
This commit is contained in:
18
docs/site/utils/i18n.js
Normal file
18
docs/site/utils/i18n.js
Normal file
@@ -0,0 +1,18 @@
|
||||
// component mixin
|
||||
import { get } from '../../../src/utils';
|
||||
import { camelize } from '../../../src/utils/format/string';
|
||||
|
||||
export default {
|
||||
computed: {
|
||||
$t() {
|
||||
const { name } = this.$options;
|
||||
const prefix = name ? camelize(name) + '.' : '';
|
||||
const messages = this.$vantMessages[this.$vantLang];
|
||||
|
||||
return (path, ...args) => {
|
||||
const message = get(messages, prefix + path) || get(messages, path);
|
||||
return typeof message === 'function' ? message(...args) : message;
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user