mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: temporarily comment some code
This commit is contained in:
parent
d697026b2c
commit
bd0853b60e
@ -1,130 +1,130 @@
|
|||||||
import Vue from 'vue';
|
// import Vue from 'vue';
|
||||||
import Locale from '../../src/locale';
|
// import Locale from '../../src/locale';
|
||||||
import Lazyload from '../../src/lazyload';
|
// import Lazyload from '../../src/lazyload';
|
||||||
import { get } from '../../src/utils';
|
// import { get } from '../../src/utils';
|
||||||
import { camelize } from '../../src/utils/format/string';
|
// import { camelize } from '../../src/utils/format/string';
|
||||||
import enUS from '../../src/locale/lang/en-US';
|
// import enUS from '../../src/locale/lang/en-US';
|
||||||
|
|
||||||
Vue.use(Lazyload, {
|
// Vue.use(Lazyload, {
|
||||||
lazyComponent: true,
|
// lazyComponent: true,
|
||||||
});
|
// });
|
||||||
|
|
||||||
Locale.add({
|
// Locale.add({
|
||||||
'en-US': enUS,
|
// 'en-US': enUS,
|
||||||
});
|
// });
|
||||||
|
|
||||||
// flag for vant-weapp demos
|
// // flag for vant-weapp demos
|
||||||
const isWeapp = location.search.indexOf('weapp=1') !== -1;
|
// const isWeapp = location.search.indexOf('weapp=1') !== -1;
|
||||||
|
|
||||||
let demoUid = 0;
|
// let demoUid = 0;
|
||||||
|
|
||||||
// helper for demo locales
|
// // helper for demo locales
|
||||||
Vue.mixin({
|
// Vue.mixin({
|
||||||
computed: {
|
// computed: {
|
||||||
t() {
|
// t() {
|
||||||
const { name } = this.$options;
|
// const { name } = this.$options;
|
||||||
const { lang = 'zh-CN' } = (this.$route && this.$route.meta) || {};
|
// const { lang = 'zh-CN' } = (this.$route && this.$route.meta) || {};
|
||||||
const prefix = name ? camelize(name) + '.' : '';
|
// const prefix = name ? camelize(name) + '.' : '';
|
||||||
const messages = this.$vantMessages[lang];
|
// const messages = this.$vantMessages[lang];
|
||||||
|
|
||||||
return (path, ...args) => {
|
// return (path, ...args) => {
|
||||||
const message = get(messages, prefix + path) || get(messages, path);
|
// const message = get(messages, prefix + path) || get(messages, path);
|
||||||
return typeof message === 'function' ? message(...args) : message;
|
// return typeof message === 'function' ? message(...args) : message;
|
||||||
};
|
// };
|
||||||
},
|
// },
|
||||||
|
|
||||||
isWeapp() {
|
// isWeapp() {
|
||||||
return isWeapp;
|
// return isWeapp;
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
|
|
||||||
beforeCreate() {
|
// beforeCreate() {
|
||||||
if (!this.$options.name) {
|
// if (!this.$options.name) {
|
||||||
this.$options.name = `demo-${demoUid++}`;
|
// this.$options.name = `demo-${demoUid++}`;
|
||||||
}
|
// }
|
||||||
|
|
||||||
const { i18n, name } = this.$options;
|
// const { i18n, name } = this.$options;
|
||||||
|
|
||||||
if (i18n && name) {
|
// if (i18n && name) {
|
||||||
const locales = {};
|
// const locales = {};
|
||||||
const camelizedName = camelize(name);
|
// const camelizedName = camelize(name);
|
||||||
|
|
||||||
Object.keys(i18n).forEach((key) => {
|
// Object.keys(i18n).forEach((key) => {
|
||||||
locales[key] = { [camelizedName]: i18n[key] };
|
// locales[key] = { [camelizedName]: i18n[key] };
|
||||||
});
|
// });
|
||||||
|
|
||||||
Locale.add(locales);
|
// Locale.add(locales);
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
// switch lang after routing
|
// // switch lang after routing
|
||||||
if (window.vueRouter) {
|
// if (window.vueRouter) {
|
||||||
window.vueRouter.afterEach((to) => {
|
// window.vueRouter.afterEach((to) => {
|
||||||
const { lang } = to.meta || {};
|
// const { lang } = to.meta || {};
|
||||||
|
|
||||||
if (lang) {
|
// if (lang) {
|
||||||
Locale.use(lang);
|
// Locale.use(lang);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
|
|
||||||
// add some basic locale messages
|
// // add some basic locale messages
|
||||||
Locale.add({
|
// Locale.add({
|
||||||
'zh-CN': {
|
// 'zh-CN': {
|
||||||
add: '增加',
|
// add: '增加',
|
||||||
decrease: '减少',
|
// decrease: '减少',
|
||||||
red: '红色',
|
// red: '红色',
|
||||||
orange: '橙色',
|
// orange: '橙色',
|
||||||
yellow: '黄色',
|
// yellow: '黄色',
|
||||||
purple: '紫色',
|
// purple: '紫色',
|
||||||
tab: '标签',
|
// tab: '标签',
|
||||||
tag: '标签',
|
// tag: '标签',
|
||||||
desc: '描述信息',
|
// desc: '描述信息',
|
||||||
back: '返回',
|
// back: '返回',
|
||||||
title: '标题',
|
// title: '标题',
|
||||||
status: '状态',
|
// status: '状态',
|
||||||
button: '按钮',
|
// button: '按钮',
|
||||||
option: '选项',
|
// option: '选项',
|
||||||
search: '搜索',
|
// search: '搜索',
|
||||||
content: '内容',
|
// content: '内容',
|
||||||
custom: '自定义',
|
// custom: '自定义',
|
||||||
username: '用户名',
|
// username: '用户名',
|
||||||
password: '密码',
|
// password: '密码',
|
||||||
disabled: '禁用状态',
|
// disabled: '禁用状态',
|
||||||
uneditable: '不可编辑',
|
// uneditable: '不可编辑',
|
||||||
basicUsage: '基础用法',
|
// basicUsage: '基础用法',
|
||||||
advancedUsage: '高级用法',
|
// advancedUsage: '高级用法',
|
||||||
loadingStatus: '加载状态',
|
// loadingStatus: '加载状态',
|
||||||
usernamePlaceholder: '请输入用户名',
|
// usernamePlaceholder: '请输入用户名',
|
||||||
passwordPlaceholder: '请输入密码',
|
// passwordPlaceholder: '请输入密码',
|
||||||
},
|
// },
|
||||||
'en-US': {
|
// 'en-US': {
|
||||||
add: 'Add',
|
// add: 'Add',
|
||||||
decrease: 'Decrease',
|
// decrease: 'Decrease',
|
||||||
red: 'Red',
|
// red: 'Red',
|
||||||
orange: 'Orange',
|
// orange: 'Orange',
|
||||||
yellow: 'Yellow',
|
// yellow: 'Yellow',
|
||||||
purple: 'Purple',
|
// purple: 'Purple',
|
||||||
tab: 'Tab',
|
// tab: 'Tab',
|
||||||
tag: 'Tag',
|
// tag: 'Tag',
|
||||||
desc: 'Description',
|
// desc: 'Description',
|
||||||
back: 'Back',
|
// back: 'Back',
|
||||||
title: 'Title',
|
// title: 'Title',
|
||||||
status: 'Status',
|
// status: 'Status',
|
||||||
button: 'Button',
|
// button: 'Button',
|
||||||
option: 'Option',
|
// option: 'Option',
|
||||||
search: 'Search',
|
// search: 'Search',
|
||||||
content: 'Content',
|
// content: 'Content',
|
||||||
custom: 'Custom',
|
// custom: 'Custom',
|
||||||
username: 'Username',
|
// username: 'Username',
|
||||||
password: 'Password',
|
// password: 'Password',
|
||||||
loadingStatus: 'Loading',
|
// loadingStatus: 'Loading',
|
||||||
disabled: 'Disabled',
|
// disabled: 'Disabled',
|
||||||
uneditable: 'Uneditable',
|
// uneditable: 'Uneditable',
|
||||||
basicUsage: 'Basic Usage',
|
// basicUsage: 'Basic Usage',
|
||||||
advancedUsage: 'Advanced Usage',
|
// advancedUsage: 'Advanced Usage',
|
||||||
usernamePlaceholder: 'Username',
|
// usernamePlaceholder: 'Username',
|
||||||
passwordPlaceholder: 'Password',
|
// passwordPlaceholder: 'Password',
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as compiler from 'vue-template-compiler';
|
import * as compiler from '@vue/compiler-sfc';
|
||||||
import * as compileUtils from '@vue/component-compiler-utils';
|
import * as compileUtils from '@vue/component-compiler-utils';
|
||||||
import hash from 'hash-sum';
|
import hash from 'hash-sum';
|
||||||
import { parse } from 'path';
|
import { parse } from 'path';
|
||||||
@ -87,7 +87,7 @@ export async function compileSfc(filePath: string): Promise<any> {
|
|||||||
const descriptor = parseSfc(filePath);
|
const descriptor = parseSfc(filePath);
|
||||||
const { template, styles } = descriptor;
|
const { template, styles } = descriptor;
|
||||||
|
|
||||||
const hasScoped = styles.some(s => s.scoped);
|
const hasScoped = styles.some((s) => s.scoped);
|
||||||
const scopeId = hasScoped ? `data-v-${hash(source)}` : '';
|
const scopeId = hasScoped ? `data-v-${hash(source)}` : '';
|
||||||
|
|
||||||
// compile js part
|
// compile js part
|
||||||
@ -107,9 +107,7 @@ export async function compileSfc(filePath: string): Promise<any> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
writeFileSync(jsFilePath, script);
|
writeFileSync(jsFilePath, script);
|
||||||
compileJs(jsFilePath)
|
compileJs(jsFilePath).then(resolve).catch(reject);
|
||||||
.then(resolve)
|
|
||||||
.catch(reject);
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Vue from 'vue';
|
// import Vue from 'vue';
|
||||||
import 'jest-canvas-mock';
|
import 'jest-canvas-mock';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import Package from '../../dist/package-entry';
|
// import Package from '../../dist/package-entry';
|
||||||
|
|
||||||
Vue.use(Package);
|
// Vue.use(Package);
|
||||||
|
@ -40,26 +40,26 @@ const plugins = [
|
|||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
const tsconfigPath = join(CWD, 'tsconfig.json');
|
// const tsconfigPath = join(CWD, 'tsconfig.json');
|
||||||
if (existsSync(tsconfigPath)) {
|
// if (existsSync(tsconfigPath)) {
|
||||||
const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin');
|
// const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin');
|
||||||
plugins.push(
|
// plugins.push(
|
||||||
new ForkTsCheckerPlugin({
|
// new ForkTsCheckerPlugin({
|
||||||
formatter: 'codeframe',
|
// formatter: 'codeframe',
|
||||||
vue: { enabled: true },
|
// vue: { enabled: true },
|
||||||
logger: {
|
// logger: {
|
||||||
// skip info message
|
// // skip info message
|
||||||
info() {},
|
// info() {},
|
||||||
warn(message: string) {
|
// warn(message: string) {
|
||||||
consola.warn(message);
|
// consola.warn(message);
|
||||||
},
|
// },
|
||||||
error(message: string) {
|
// error(message: string) {
|
||||||
consola.error(message);
|
// consola.error(message);
|
||||||
},
|
// },
|
||||||
},
|
// },
|
||||||
})
|
// })
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
export const baseConfig = {
|
export const baseConfig = {
|
||||||
mode: 'development',
|
mode: 'development',
|
||||||
@ -112,7 +112,7 @@ export const baseConfig = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.md$/,
|
test: /\.md$/,
|
||||||
use: [CACHE_LOADER, 'vue-loader', '@vant/markdown-loader'],
|
use: [CACHE_LOADER, '@vant/markdown-loader'],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user