mirror of
https://github.com/tenrok/vue2-datepicker.git
synced 2026-06-24 05:40:35 +03:00
chore: optimize the example code
This commit is contained in:
+3
-7
@@ -120,7 +120,6 @@ const App = {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
lang: 'en',
|
lang: 'en',
|
||||||
hackReset: true,
|
|
||||||
currentId: this.getCurrentId(),
|
currentId: this.getCurrentId(),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -140,10 +139,6 @@ const App = {
|
|||||||
const lang = this.lang === 'en' ? 'zh-cn' : 'en';
|
const lang = this.lang === 'en' ? 'zh-cn' : 'en';
|
||||||
this.lang = lang;
|
this.lang = lang;
|
||||||
this.changeLocale(lang);
|
this.changeLocale(lang);
|
||||||
this.hackReset = false;
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.hackReset = true;
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
render(h) {
|
render(h) {
|
||||||
@@ -169,8 +164,8 @@ const App = {
|
|||||||
{this.lang === 'en' ? '中文' : 'English'}
|
{this.lang === 'en' ? '中文' : 'English'}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{this.hackReset &&
|
<div key={this.lang}>
|
||||||
components.map(item => {
|
{components.map(item => {
|
||||||
const { component, id, code } = item;
|
const { component, id, code } = item;
|
||||||
const props = {
|
const props = {
|
||||||
id,
|
id,
|
||||||
@@ -180,6 +175,7 @@ const App = {
|
|||||||
};
|
};
|
||||||
return <Card {...{ props }}>{h(component)}</Card>;
|
return <Card {...{ props }}>{h(component)}</Card>;
|
||||||
})}
|
})}
|
||||||
|
</div>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
||||||
<title>Document</title>
|
<title>Document</title>
|
||||||
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css" />
|
<link rel="stylesheet" href="https://unpkg.com/normalize.css@8.0.1/normalize.css" />
|
||||||
<script src="https://polyfill.io/v3/polyfill.js?features=Object.assign,Array.from,Promise,fetch&flags=gated"></script>
|
<!-- <script src="https://polyfill.io/v3/polyfill.js?features=Object.assign,Array.from,Promise,fetch&flags=gated"></script> -->
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user