mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[new feature] Cell support vue-router target route (#268)
* [bugfix] CouponList always show empty info * [bugfix] add click feedback of buttons in components * [Doc] add custom theme document * [new feature] Notice bar support more props * [bugfix] PullRefresh test cases * [bugfix] unused NoticeBar style * [bugfix] Swipe width calc error * [Doc] english document of all action components * [Doc] change document site path to /zanui/vant * [Doc] fix * [bugfix] uploader style error * [bugfix] tabs document demo * [new feature] Cell support vue-router target route * [bugfix] add cell test cases * update yarn.lock
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<a :class="['van-cell', 'van-hairline', { 'van-cell--required': required }]" :href="url" @click="$emit('click')">
|
||||
<div :class="['van-cell', 'van-hairline', { 'van-cell--required': required }]" @click="onClick">
|
||||
<div class="van-cell__title" v-if="$slots.title || title">
|
||||
<slot name="icon">
|
||||
<van-icon v-if="icon" :name="icon" />
|
||||
@@ -25,7 +25,7 @@
|
||||
<van-icon name="arrow" class="van-cell__right-icon" v-if="isLink" />
|
||||
</slot>
|
||||
<slot name="extra" />
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -39,13 +39,28 @@ export default {
|
||||
},
|
||||
|
||||
props: {
|
||||
url: String,
|
||||
icon: String,
|
||||
title: String,
|
||||
value: [String, Number],
|
||||
url: String,
|
||||
label: String,
|
||||
isLink: Boolean,
|
||||
required: Boolean
|
||||
replace: Boolean,
|
||||
required: Boolean,
|
||||
to: [String, Object],
|
||||
value: [String, Number]
|
||||
},
|
||||
|
||||
methods: {
|
||||
onClick() {
|
||||
this.$emit('click');
|
||||
|
||||
const { to, url, $router, replace } = this;
|
||||
if (to && $router) {
|
||||
$router[replace ? 'replace' : 'push'](to);
|
||||
} else if (url) {
|
||||
replace ? location.replace(url) : location.href = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user