Comments (6)
If the data source of v-selectpage
is not from server side, you don't have to specify dataLoad
option in plugin install.
<v-selectpage :data="list" v-model="value" @values="values">
</v-selectpage>
//script
data(){
return {
value: '',
list: [
{id:1,name:'aaa'},
{id:2,name:'bbb'},
{id:3,name:'ccc'},
{id:4,name:'ddd'}
]
};
},
methods: {
values(picked){
console.log(picked);
}
}
from v-selectpage.
But, what if I want to use it server side. Having the axios function located in the main.js file is really out of the way if I need to customize/change anything per request. Debouncing comes up as an issue too, since it calls back on every keystroke. I'm gonna make a pull request with some enhancements :) Thanks for the hard work on the control!
from v-selectpage.
Config dataLoad
option in plugin install, is tell to plugin how to request server side data when we need, it's just a one-time operation.
The data
option of v-selectpage
have 2 data types(string | Array), when you set string type content as server side url, plugin will call dataLoad
method to load server side data.when you set Array content like this:
[
{id:1,name:'aaa'},
{id:2,name:'bbb'},
{id:3,name:'ccc'},
{id:4,name:'ddd'},
]
v-selectpage
will use this Array data directly as a data source, and will not going to call dataLoad
method.
So the conclusion is set dataLoad
option in plugin install, is show the way how to load server side data.
When useing v-selectpage
, want to load server side data, give it(data option) string type content as url, want to use local data, just give it an Array.
from v-selectpage.
这样全局配置确实有不方便的地方,例如后台使用graphql的时候,需要把搜索的内容作为参数拼接到查询字符串里面传给后台,因为字符串的内容比较长,使用了ES6的字符串模板,不同地方使用的字符串不一样,全局配置不够灵活,例如下面的字符串模板:{ MdDictionary(id: ${localMDField.id}) { entryPage( rowRequest:{ start: ${start} rows: ${rows} filter: { ${ searchKey ?
filterType: string
operator: "contains"
field: "${searchKey}"
value: "${searchValue}":
filterType: or
conditions: [
{
filterType: string
operator: "contains"
field: "key"
value: "${search}"
},
{
filterType: string
operator: "contains"
field: "value"
value: "${search}"
}
] } } } ) { rows { id key value } total } } }
这个模板不是固定的,所以全局配置的话就比较难办了
from v-selectpage.
这样全局配置确实有不方便的地方,例如后台使用graphql的时候,需要把搜索的内容作为参数拼接到查询字符串里面传给后台,因为字符串的内容比较长,使用了ES6的字符串模板,不同地方使用的字符串不一样,全局配置不够灵活,例如下面的字符串模板:
{ MdDictionary(id: ${localMDField.id}) { entryPage( rowRequest:{ start: ${start} rows: ${rows} filter: { ${ searchKey ?
filterType: string
operator: "contains"
field: "${searchKey}"
value: "${searchValue}":
filterType: or
conditions: [
{
filterType: string
operator: "contains"
field: "key"
value: "${search}"
},
{
filterType: string
operator: "contains"
field: "value"
value: "${search}"
}
]} } } ) { rows { id key value } total } } }
这个模板不是固定的,所以全局配置的话就比较难办了
首先每个插件都是可以单独设置 dataLoad
参数的,全局配置只是提供了可以在全局设置插件的 dataLoad
行为的方式,不用每个使用 v-selectpage
的地方再去配置而已
<v-selectpage :data-load="dataLoad">
</v-selectpage>
//script
methods: {
dataLoad () {
do something...
}
}
from v-selectpage.
//script
methods: {
dataLoad () {
do something...
}
}如果data配置的是url,从服务器返回数据而不是使用静态数组,这样配置data-load好像没生效,不知道是否哪里配错了?
from v-selectpage.
Related Issues (20)
- 不显示组件 HOT 1
- 组件问题很多 默认选中无法实现 指定值必须为number 异步加载数据初始化触发两次 HOT 2
- 服务端模式完全不进行数据拉取,dataLoad函数没有反应 HOT 3
- v-selectpage 打包后的问题 HOT 5
- 下载了v-selectpage 后本地跑图标会出不来 HOT 2
- 怎么设置成行内元素? HOT 2
- 多选下清除picked后自动展示出下拉框 HOT 6
- 服务端数据模式 数据初始化异常 HOT 2
- 组件能否自定义一个方法?
- ant-design-of-vue Modal使用v-selectPage多选模式 HOT 1
- 在第3页更新数据,更新成功后,分页和数据都显示在第三页,如何回到第一页
- v-model is not updating the value HOT 1
- Vue3支持吗? HOT 4
- You may have an infinite update loop in watcher with expression "picked"
- Remove all items in selector mode HOT 3
- SelectPageTable 多选模式下,选择多个后删除,下拉框样式只会是初始的位置,不会跟随着数据变化,而调整位置 HOT 1
- 咨询 选项字体过长问题 HOT 1
- how to add a new language HOT 1
- selected v-model as single item
- Unstyled mode support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from v-selectpage.