1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <template>
- <div class="btngroup">
- <van-button
- v-if="weibo && weibo['6m'][type] && weibo['6m'][type].length"
- :type="readType === '6m' ? 'info' : 'default'"
- @click="() => selectClick('6m')"
- size="mini"
- >
- 1小时
- </van-button>
- <van-button
- v-if="weibo && weibo['24h'][type] && weibo['24h'][type].length"
- :type="readType === '24h' ? 'info' : 'default'"
- @click="() => selectClick('24h')"
- size="mini"
- >
- 24小时
- </van-button>
- <van-button
- v-if="weibo && weibo['7d'][type] && weibo['7d'][type].length"
- :type="readType === '7d' ? 'info' : 'default'"
- @click="() => selectClick('7d')"
- size="mini"
- >
- 7天
- </van-button>
- <van-button
- v-if="weibo && weibo['30d'][type] && weibo['30d'][type].length"
- :type="readType === '30d' ? 'info' : 'default'"
- @click="() => selectClick('30d')"
- size="mini"
- >
- 30天
- </van-button>
- </div>
- </template>
- <style scoped>
- .btngroup {
- float: right;
- padding-right: 5px;
- display: inline-block;
- }
- </style>
- <script>
- import { Button as vanButton } from "vant";
- import "vant/lib/button/style";
- export default {
- components: {
- vanButton,
- },
- props: {
- type: {
- type: String,
- value: "",
- },
- weibo: {
- type: Object,
- value: () => {
- return {};
- },
- },
- },
- data() {
- return {
- readType: "30d",
- };
- },
- created() {},
- methods: {
- selectClick(key) {
- if (key === this.readType) return;
- this.$emit("changeBtn", { key, type: this.type }, () => {
- this.readType = key;
- });
- },
- },
- };
- </script>
|