Giter Club home page Giter Club logo

Comments (5)

tw93 avatar tw93 commented on May 18, 2024

第一个问题 需要 :style这样写,不然你传入的就是string类型了
第二个问题 国际化的东西可以试试这个 https://github.com/kazupon/vue-i18n
第三个问题 是支持的,设置webstorm js 为es6就好,但是建议放到methods处理会优雅一点

from incubator-weex-ui.

phoenixsky avatar phoenixsky commented on May 18, 2024

ok,第二个我去研究下.
第三个问题,我是不知道有这种写法的.是在weex-ui这个demo中学的.哈哈哈

第一个问题没有表达清楚.我的意思是.

  1. 页面第一次加载的时候,使用style="background-color: red"的方式是生效的.
  2. 但是经过@onSelected方法后,通过字面量定义的style就不生效了.

我代码中option-text'就是一个点击后会弹出一个选项列表,选择一个选项后,通过回调执行@onSelected()方法,将选中的值,赋给页面中的item.value,页面加载后,背景都是红的,点击option-text,回调后,通过style="background-color: red"`定义的红色背景就无效了.

以上情况有个前提就是,class中已经定义过了style中定义的属性,才会出现.
比如 input的选择器和style中都定义了 background-color属性

刚学前端,遇到问题有些棘手,感谢帮忙

from incubator-weex-ui.

tw93 avatar tw93 commented on May 18, 2024

native 和 web 渲染都一样吗?

from incubator-weex-ui.

phoenixsky avatar phoenixsky commented on May 18, 2024

重新缕了一下,android端用playground预览和直接运行在android native中都有这个问题.
我写了个简单的demo.

<template>
    <div style="width: 750px;">
        <text style="width: 100px;height: 100px;background-color: #afddff" @click="item.value = 10"></text>
        <input class="input" style="background-color: red; font-size: 50px" :value="item.value"/>
    </div>
</template>

<style scoped>
    .input {
        background-color: gray;
    }
</style>

<script>
    export default {
        data() {
            return {
                item: {
                    key: 2,
                    value: 1,
                }
            }
        }
    }
</script>

根据效果来分析是,只要input绑定的value发生了变化,那么这个input会重新渲染,但是重新渲染的时候,通过字面量赋值的style里的属性,如果在class也有,就会被忽略.

from incubator-weex-ui.

tw93 avatar tw93 commented on May 18, 2024

@phoenixsky 我看了看native这边都有这个问题的,建议写成{backgroundColor: red} 这样哦
内部处理问题,重新渲染没有考虑那种情况

from incubator-weex-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.