mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-09-07 08:19:45 +08:00
feat: add emits option
This commit is contained in:
parent
6995bcc8a3
commit
0e4b5a0f2f
@ -44,6 +44,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['click', 'touchstart'],
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onClick() {
|
onClick() {
|
||||||
if (!this.loading && !this.disabled) {
|
if (!this.loading && !this.disabled) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<demo-section>
|
<demo-section>
|
||||||
<demo-block :title="t('basicUsage')">
|
<demo-block :title="t('basicUsage')">
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell :title="t('cell')" :value="t('content')" />
|
<van-cell :title="t('cell')" :value="t('content')" @click="onClick" />
|
||||||
<van-cell :title="t('cell')" :value="t('content')" :label="t('desc')" />
|
<van-cell :title="t('cell')" :value="t('content')" :label="t('desc')" />
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
@ -108,6 +108,12 @@ export default {
|
|||||||
verticalCenter: 'Vertical center',
|
verticalCenter: 'Vertical center',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
onClick() {
|
||||||
|
console.log('click');
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ export default createComponent({
|
|||||||
...routeProps,
|
...routeProps,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['click'],
|
||||||
|
|
||||||
setup(props, { slots, emit }) {
|
setup(props, { slots, emit }) {
|
||||||
return function () {
|
return function () {
|
||||||
const { icon, size, title, label, value, isLink } = props;
|
const { icon, size, title, label, value, isLink } = props;
|
||||||
|
@ -15,6 +15,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['click'],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
style() {
|
style() {
|
||||||
const { index } = this;
|
const { index } = this;
|
||||||
|
@ -31,6 +31,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['load', 'error', 'click'],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: true,
|
loading: true,
|
||||||
|
@ -39,13 +39,12 @@ export const popupMixinProps = {
|
|||||||
|
|
||||||
export function PopupMixin(options = {}) {
|
export function PopupMixin(options = {}) {
|
||||||
return {
|
return {
|
||||||
mixins: [
|
mixins: [TouchMixin, CloseOnPopstateMixin],
|
||||||
TouchMixin,
|
|
||||||
CloseOnPopstateMixin,
|
|
||||||
],
|
|
||||||
|
|
||||||
props: popupMixinProps,
|
props: popupMixinProps,
|
||||||
|
|
||||||
|
emits: ['open', 'close', 'update:show', 'click-overlay'],
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
inited: this.show,
|
inited: this.show,
|
||||||
|
@ -39,6 +39,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['click', 'opened', 'closed'],
|
||||||
|
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
const createEmitter = (eventName) => (event) =>
|
const createEmitter = (eventName) => (event) =>
|
||||||
this.$emit(eventName, event);
|
this.$emit(eventName, event);
|
||||||
|
@ -20,6 +20,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['click'],
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
spaces() {
|
spaces() {
|
||||||
const gutter = Number(this.gutter);
|
const gutter = Number(this.gutter);
|
||||||
|
@ -22,6 +22,8 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
emits: ['close'],
|
||||||
|
|
||||||
setup(props, { slots, emit }) {
|
setup(props, { slots, emit }) {
|
||||||
return function () {
|
return function () {
|
||||||
const { type, mark, plain, color, round, size } = props;
|
const { type, mark, plain, color, round, size } = props;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user