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

KPickerView 设置默认值 web端和小程序端实际结果不同 #21

Open
OooOooosss opened this issue Jun 4, 2020 · 4 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@OooOooosss
Copy link

1591248484224
web端初始位置无效,小程序正常

@JimmyVV
Copy link
Contributor

JimmyVV commented Jun 5, 2020

好的,这个我跟进看一下

@JimmyVV JimmyVV added the bug Something isn't working label Jun 5, 2020
@JimmyVV JimmyVV self-assigned this Jun 5, 2020
@JimmyVV
Copy link
Contributor

JimmyVV commented Jun 5, 2020

已经修复了,可以使用

@rushairer
Copy link

在mp下不响应事件,web下正常

[email protected]

<template>
  <KView>
    <div class="weui-cells__title">内容</div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell weui-cell_active">
            <div class="weui-cell__bd">
                <textarea class="weui-textarea"
                          placeholder="请输入海报内容"
                          rows="10"
                          maxlength="-1"
                          v-model="posterText"></textarea>
            </div>
        </div>
    </div>
    <div class="weui-cells__title">背景色</div>
    <KPickerView indicator-style="height: 60px;"
                 v-model="colorIndex"
                 style="width: 100%; height:120px;"
                 @change="changeColor">
        <KPickerViewColumn>
                    <KView v-for="(item,index) in colors"
                          :style="{lineHeight: '80px', backgroundColor: item}"
                          :key="index" >
                    </KView>
        </KPickerViewColumn>
    </KPickerView>
    <div class="weui-cells__title">预览</div>
    <div class="weui-cell"
        :style="{backgroundColor: color, color: '#FFFFFF'}">
      {{ posterText ? posterText : '这是海报正文' }}
    </div>
    <div class="weui-cell">
        <KButton type="primary" @click="save">保存图片</KButton>
    </div>
  </KView>
</template>

<script>
import Vue from 'vue'

export default Vue.extend({
  name: 'Home',
  data() {
    return {
      posterText: null,
      colors: [
        '#2C2C2E',
        '#0A84FF',
        '#30D158',
        '#5E5CE6',
        '#FF9F0A',
        '#FF375F',
        '#BF5AF2',
        '#FF453A',
        '#64D2FF',
        '#FFD60A',
      ],
      colorIndex: 0,
      color: null,
    }
  },
  computed: {
  },
  components: {
  },
  created() {
    window.addEventListener('wxload', query => console.log('page1 wxload', query))
    window.addEventListener('wxshow', () => console.log('page1 wxshow'))
    window.addEventListener('wxready', () => console.log('page1 wxready'))
    window.addEventListener('wxhide', () => console.log('page1 wxhide'))
    window.addEventListener('wxunload', () => console.log('page1 wxunload'))

    this.color = this.colors[this.colorIndex]
  },
  methods: {
    changeColor(index) {
      this.color = this.colors[index]
      this.posterText = index
    },
    save() {
    }
  },
})
</script>

<style lang="less">
</style>

@JimmyVV
Copy link
Contributor

JimmyVV commented Jun 15, 2020

已经修复,为了对齐小程序。目前 index 修改为 array 的传入方式:

export default Vue.extend({
  name: 'Home',
  data() {
    return {
      colorIndex: [0],
      color: null,
    }
  },

可以使用 0.6.8 的包试试。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants