[new feature] ImagePreview: support component call (#3154)

This commit is contained in:
neverland
2019-04-15 19:59:05 +08:00
committed by GitHub
parent ad6be337cc
commit e8762b2a50
3 changed files with 125 additions and 4 deletions
+23 -2
View File
@@ -11,6 +11,14 @@
<demo-block :title="$t('button3')">
<van-button @click="showImagePreview(0, 1000)">{{ $t('button3') }}</van-button>
</demo-block>
<demo-block :title="$t('componentCall')">
<van-button @click="componentCall">{{ $t('componentCall') }}</van-button>
<van-image-preview
v-model="show"
:images="images"
/>
</demo-block>
</demo-section>
</template>
@@ -29,16 +37,29 @@ export default {
'zh-CN': {
button1: '预览图片',
button2: '指定初始位置',
button3: '异步关闭'
button3: '异步关闭',
componentCall: '组件调用'
},
'en-US': {
button1: 'Show Images',
button2: 'Custom Start Position',
button3: 'Async Close'
button3: 'Async Close',
componentCall: 'Component Call'
}
},
data() {
return {
show: false,
images
};
},
methods: {
componentCall() {
this.show = true;
},
showImagePreview(position, timer) {
const instance = ImagePreview({
images,