diff --git a/packages/empty/index.ts b/packages/empty/index.ts
index 044faba9..f58d7f6d 100644
--- a/packages/empty/index.ts
+++ b/packages/empty/index.ts
@@ -1,7 +1,5 @@
import { VantComponent } from '../common/component';
-const PRESETS = ['error', 'search', 'default', 'network'];
-
VantComponent({
props: {
description: String,
@@ -10,13 +8,4 @@ VantComponent({
value: 'default',
},
},
- created() {
- if (PRESETS.indexOf(this.data.image) !== -1) {
- this.setData({
- imageUrl: `https://img.yzcdn.cn/vant/empty-image-${this.data.image}.png`,
- });
- } else {
- this.setData({ imageUrl: this.data.image });
- }
- },
});
diff --git a/packages/empty/index.wxml b/packages/empty/index.wxml
index b6a2cb3c..9c7b719a 100644
--- a/packages/empty/index.wxml
+++ b/packages/empty/index.wxml
@@ -1,11 +1,12 @@
+
-
+
diff --git a/packages/empty/index.wxs b/packages/empty/index.wxs
new file mode 100644
index 00000000..9696dd47
--- /dev/null
+++ b/packages/empty/index.wxs
@@ -0,0 +1,14 @@
+/* eslint-disable */
+var PRESETS = ['error', 'search', 'default', 'network'];
+
+function imageUrl(image) {
+ if (PRESETS.indexOf(image) !== -1) {
+ return 'https://img.yzcdn.cn/vant/empty-image-' + image + '.png';
+ }
+
+ return image;
+}
+
+module.exports = {
+ imageUrl: imageUrl,
+};