Git Product home page Git Product logo

Comments (10)

vvpvvp avatar vvpvvp commented on July 20, 2024

怎么直接集成,能把代码发出来吗?

from model.

kuangshp avatar kuangshp commented on July 20, 2024

{{ msg }}

{{a}} {{a.b}}
<script> import Test1 from './../model/Test1.js'; let a = Test1.parse({}); console.log(a.b); export default { name: 'HelloWorld', data () { return { msg: 'Welcome to Your Vue.js App', a, } } } </script>

import Model from "js-model";
export default new Model({
a: {
b: {
c: Number
},
d: String
},
})


我这样输出a是一个对象,但是a.b就是undefined

from model.

kuangshp avatar kuangshp commented on July 20, 2024
import Model from "js-model";
export default new Model({
  a: {
    b: {
        c: Number
    },
    d: String
  },
})

<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    {{a}}
    <hr>
  </div>
</template>

<script>
import Test1 from './../model/Test1.js';
let a = Test1.parse({});
console.log(a.b);
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App',
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>

我这样输出a是一个对象,但是a.b就是undefined

from model.

vvpvvp avatar vvpvvp commented on July 20, 2024
<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    {{a}}
    <hr>
  </div>
</template>

<script>
import Test1 from './../model/Test1.js';

export default {
  name: 'HelloWorld',
  data () {
    return {
      a: Test1.parse({}),
      msg: 'Welcome to Your Vue.js App',
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>

我写的是伪代码,你也不用用的这么直接啊?

from model.

kuangshp avatar kuangshp commented on July 20, 2024

知道是伪代码,我也是看到这个东西比较好,尝试下,今后用在项目中,能发下你使用的代码出来看下吗

from model.

vvpvvp avatar vvpvvp commented on July 20, 2024

你按照上面的代码就可以了,你也可以等等,我整理一个vue的使用基础sample,下午发出来。

from model.

kuangshp avatar kuangshp commented on July 20, 2024

不可以,是不是还要在哪里配置,我最近打算把数据层与视图层分开,等待sample

from model.

vvpvvp avatar vvpvvp commented on July 20, 2024

https://codepen.io/vvpvvp/pen/jpEjwW
我可以说,我自己把自己给蠢死的吗?😂😂😂😂😂

其实demo里面定义完是 a.a ,a.a.b.c, a.a.d,写文章的时候把自己给绕进去了。😭😭😭😭

from model.

kuangshp avatar kuangshp commented on July 20, 2024

我看了下,好像用途不是很大,依然要去判断,不是跟你掘金上说的,不需要判断,方便加你好友再研究下吗

from model.

vvpvvp avatar vvpvvp commented on July 20, 2024

聊天室:https://discord.gg/VUZbFmd
或者你把微信号发给我

from model.

Related Issues (10)

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.