Skip to content

Instantly share code, notes, and snippets.

@ygmpkk
Created September 28, 2018 11:17
Show Gist options
  • Save ygmpkk/1361d7af9167b0b434da1de7f961b835 to your computer and use it in GitHub Desktop.
Save ygmpkk/1361d7af9167b0b434da1de7f961b835 to your computer and use it in GitHub Desktop.
<template>
<view class="container">
<view>
<view>
父组件
</view>
<view>
{{ data.today.format('YYYY-MM-DD') }}
</view>
<view>
{{ today.format('YYYY-MM-DD') }}
</view>
<view>
{{ formatted }}
</view>
</view>
<play :data="data" :today="today" :formatted="formatted" />
</view>
</template>
<style></style>
<script>
import play from '../components/play'
import dayjs from 'dayjs'
export default {
components: {
play,
},
data() {
return {
today: dayjs('2018-09-28'),
formatted: '2018-09-28',
data: {
today: dayjs('2018-09-28')
},
};
},
mounted() {
console.log('delay change state')
this.data = {today: dayjs('2018-10-08')}
this.today = dayjs('2018-10-08')
this.formatted = '2018-10-08'
},
methods: {
},
};
</script>
<template>
<view class="container">
<view>
<view>
父组件
</view>
<view>
{{ data.today.format('YYYY-MM-DD') }}
</view>
<view>
{{ today.format('YYYY-MM-DD') }}
</view>
<view>
{{ formatted }}
</view>
</view>
<play :data="data" :today="today" :formatted="formatted" />
</view>
</template>
<style></style>
<script>
import play from '../components/play'
import dayjs from 'dayjs'
export default {
components: {
play,
},
data() {
return {
today: dayjs('2018-09-28'),
formatted: '2018-09-28',
data: {
today: dayjs('2018-09-28')
},
};
},
mounted() {
console.log('delay change state')
this.data = {today: dayjs('2018-10-08')}
this.today = dayjs('2018-10-08')
this.formatted = '2018-10-08'
},
methods: {
},
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment