| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { use } from '../utils';
- var _use = use('tabbar'),
- sfc = _use[0],
- bem = _use[1];
- export default sfc({
- data: function data() {
- return {
- items: []
- };
- },
- props: {
- value: Number,
- activeColor: String,
- safeAreaInsetBottom: Boolean,
- fixed: {
- type: Boolean,
- "default": true
- },
- zIndex: {
- type: Number,
- "default": 1
- }
- },
- watch: {
- items: function items() {
- this.setActiveItem();
- },
- value: function value() {
- this.setActiveItem();
- }
- },
- methods: {
- setActiveItem: function setActiveItem() {
- var _this = this;
- this.items.forEach(function (item, index) {
- item.active = index === _this.value;
- });
- },
- onChange: function onChange(active) {
- if (active !== this.value) {
- this.$emit('input', active);
- this.$emit('change', active);
- }
- }
- },
- render: function render(h) {
- return h("div", {
- "style": {
- zIndex: this.zIndex
- },
- "class": ['van-hairline--top-bottom', bem({
- fixed: this.fixed,
- 'safe-area-inset-bottom': this.safeAreaInsetBottom
- })]
- }, [this.slots()]);
- }
- });
|