Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example pages component ':key',because vue warning~ #1361

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion example/demos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<div v-for="group in navs">
<div class="page-title" v-text="group.title"></div>
<mt-cell
v-for="item in group.list"
v-for="(item,index) in group.list"
:key="index"
:to="item.path"
is-link>
<div slot="title">
Expand Down
3 changes: 2 additions & 1 deletion example/pages/cell-swipe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
<div class="page-cell">
<div class="page-title">Cell Swipe</div>
<mt-cell-swipe
v-for="n in 15"
v-for="(n,index) in 15"
:key="index"
:right="rightButtons"
title="swipe me">
</mt-cell-swipe>
Expand Down
4 changes: 2 additions & 2 deletions example/pages/index-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<p class="page-indexlist-desc">此例请使用手机查看</p>
<div class="page-indexlist-wrapper">
<mt-index-list>
<mt-index-section v-for="item in alphabet" :index="item.initial">
<mt-cell v-for="cell in item.cells" :title="cell"></mt-cell>
<mt-index-section v-for="(item,index) in alphabet" :key="index" :index="item.initial">
<mt-cell v-for="(cell,index) in item.cells" :key="index" :title="cell"></mt-cell>
</mt-index-section>
</mt-index-list>
</div>
Expand Down
6 changes: 3 additions & 3 deletions example/pages/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@

<mt-tab-container v-model="selected">
<mt-tab-container-item id="1">
<mt-cell v-for="n in 10" :title="'内容 ' + n" />
<mt-cell v-for="(n,index) in 10" :key="index" :title="'内容 ' + n" />
</mt-tab-container-item>
<mt-tab-container-item id="2">
<mt-cell v-for="n in 4" :title="'测试 ' + n" />
<mt-cell v-for="(n,index) in 4" :key="index" :title="'测试 ' + n" />
</mt-tab-container-item>
<mt-tab-container-item id="3">
<mt-cell v-for="n in 6" :title="'选项 ' + n" />
<mt-cell v-for="(n,index) in 6" :key="index" :title="'选项 ' + n" />
</mt-tab-container-item>
</mt-tab-container>
</div>
Expand Down
6 changes: 3 additions & 3 deletions example/pages/range.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
<div class="page-range">
<h1 class="page-title">Range</h1>
<p class="page-range-header">基本功能</p>
<mt-cell v-for="item in cells1" :title="item.title" :label="'value:' + item.value">
<mt-cell v-for="(item,index) in cells1" :key="index" :title="item.title" :label="'value:' + item.value">
<mt-range v-model="item.value">
<div slot="start" v-if="item.start">{{ item.start }}</div>
<div slot="end" v-if="item.end">{{ item.end }}</div>
</mt-range>
</mt-cell>
<p class="page-range-header">自定义</p>
<mt-cell v-for="item in cells2" :title="item.title" :label="'value:' + item.value">
<mt-cell v-for="(item,index) in cells2" :key="index" :title="item.title" :label="'value:' + item.value">
<mt-range v-model="item.value" :min="item.min || 0" :max="item.max || 100" :step="item.step || 1" :bar-height="item.barHeight || 1" :disabled="item.disabled">
<div slot="start" v-if="item.start">{{ item.start }}</div>
<div slot="end" v-if="item.end">{{ item.end }}</div>
</mt-range>
</mt-cell>
<p class="page-range-header">场景举例</p>
<mt-cell v-for="item in cells3" :title="item.title" :label="'value:' + item.value">
<mt-cell v-for="(item,index) in cells3" :key="index" :title="item.title" :label="'value:' + item.value">
<mt-range v-model="item.value" :min="item.min || 0" :max="item.max || 100" :step="item.step || 1">
<div slot="start" v-if="item.start" :style="{ 'font-size': item.start + 'px' }">{{ item.start }}</div>
<div slot="end" v-if="item.end" :style="{ 'font-size': item.end + 'px' }">{{ item.end }}</div>
Expand Down
6 changes: 3 additions & 3 deletions example/pages/tab-container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<div class="page-tab-container">
<mt-tab-container class="page-tabbar-tab-container" v-model="active" swipeable>
<mt-tab-container-item id="tab-container1">
<mt-cell v-for="n in 10" title="tab-container 1"></mt-cell>
<mt-cell v-for="(n,index) in 10" :key="index" title="tab-container 1"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container2">
<mt-cell v-for="n in 5" title="tab-container 2"></mt-cell>
<mt-cell v-for="(n,index) in 5" :key="index" title="tab-container 2"></mt-cell>
</mt-tab-container-item>
<mt-tab-container-item id="tab-container3">
<mt-cell v-for="n in 7" title="tab-container 3"></mt-cell>
<mt-cell v-for="(n,index) in 7" :key="index" title="tab-container 3"></mt-cell>
</mt-tab-container-item>
</mt-tab-container>
</div>
Expand Down
8 changes: 4 additions & 4 deletions example/pages/tabbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@

<mt-tab-container class="page-tabbar-container" v-model="selected">
<mt-tab-container-item id="外卖">
<mt-cell v-for="n in 10" :title="'餐厅 ' + n" />
<mt-cell v-for="(n,index) in 10" :key="index" :title="'餐厅 ' + n" />
</mt-tab-container-item>
<mt-tab-container-item id="订单">
<mt-cell v-for="n in 5" :title="'订单 ' + n" />
<mt-cell v-for="(n,index) in 5" :key="index" :title="'订单 ' + n" />
</mt-tab-container-item>
<mt-tab-container-item id="发现">
<mt-cell v-for="n in 7" :title="'发现 ' + n" />
<mt-cell v-for="(n,index) in 7" :key="index" :title="'发现 ' + n" />
</mt-tab-container-item>
<mt-tab-container-item id="我的">
<div class="page-part">
<mt-cell v-for="n in 12" :title="'我的 ' + n" />
<mt-cell v-for="(n,index) in 12" :key="index" :title="'我的 ' + n" />
</div>
<router-link to="/">
<mt-button type="danger" size="large">退出</mt-button>
Expand Down
2 changes: 1 addition & 1 deletion packages/actionsheet/src/actionsheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<transition name="actionsheet-float">
<div v-show="currentValue" class="mint-actionsheet">
<ul class="mint-actionsheet-list" :style="{ 'margin-bottom': cancelText ? '5px' : '0' }">
<li v-for="( item, index ) in actions" class="mint-actionsheet-listitem" @click.stop="itemClick(item, index)">{{ item.name }}</li>
<li v-for="( item, index ) in actions" :key="index" class="mint-actionsheet-listitem" @click.stop="itemClick(item, index)">{{ item.name }}</li>
</ul>
<a class="mint-actionsheet-button" @click.stop="currentValue = false" v-if="cancelText">{{ cancelText }}</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/checklist/src/checklist.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div @change="$emit('change', currentValue)" class="mint-checklist" :class="{ 'is-limit': max <= currentValue.length }">
<label class="mint-checklist-title" v-text="title"></label>
<x-cell v-for="option in options">
<x-cell v-for="(option,index) in options" :key="index">
<label class="mint-checklist-label" slot="title">
<span
:class="{'is-right': align === 'right'}"
Expand Down
2 changes: 1 addition & 1 deletion packages/picker/src/picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="picker" :class="{ 'picker-3d': rotateEffect }">
<div class="picker-toolbar" v-if="showToolbar"><slot></slot></div>
<div class="picker-items">
<picker-slot v-for="slot in slots" :valueKey="valueKey" :values="slot.values || []" :text-align="slot.textAlign || 'center'" :visible-item-count="visibleItemCount" :class-name="slot.className" :flex="slot.flex" v-model="values[slot.valueIndex]" :rotate-effect="rotateEffect" :divider="slot.divider" :content="slot.content" :itemHeight="itemHeight" :default-index="slot.defaultIndex"></picker-slot>
<picker-slot v-for="(slot,index) in slots" :key="index" :valueKey="valueKey" :values="slot.values || []" :text-align="slot.textAlign || 'center'" :visible-item-count="visibleItemCount" :class-name="slot.className" :flex="slot.flex" v-model="values[slot.valueIndex]" :rotate-effect="rotateEffect" :divider="slot.divider" :content="slot.content" :itemHeight="itemHeight" :default-index="slot.defaultIndex"></picker-slot>
<div class="picker-center-highlight" :style="{ height: itemHeight + 'px', marginTop: -itemHeight / 2 + 'px' }"></div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/radio/src/radio.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="mint-radiolist" @change="$emit('change', currentValue)">
<label class="mint-radiolist-title" v-text="title"></label>
<x-cell v-for="option in options">
<x-cell v-for="(option,index) in options" :key="index">
<label class="mint-radiolist-label" slot="title">
<span
:class="{'is-right': align === 'right'}"
Expand Down