Giter VIP home page Giter VIP logo

tw-city-selector's Introduction

tw-city-selector's People

Contributors

dennykuo avatar dependabot[bot] avatar shawn-go avatar xcrossd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tw-city-selector's Issues

是否能夠自行指定 name 的屬性值呢?

在使用的時候使用 js 實例的作法,
但是因為想要把資料傳到 Google 表單裡,
因此 name 的屬性值必須使用跟 Google 表單相同的值,
不知道是否有方法可以插入希望使用的 name 值呢?

<div class="form-item">
<label for="city">城市</label>
<div id="city">
<select name="entry.14110xxxxx" id="county"></select>
<select name="entry.17531xxxxx" id="district"></select>
<input type="text" name="entry.13580xxxxx" id="zip">
</div>
</div>
<script>new TwCitySelector(
{
el: "#city",
elCounty: "#county",
elDistrict: "#district",
elZipcode: "#zip"
});</script>

增加react使用方法

首先感謝你寫出這麼好用的套件,在網站開發上幫了大忙。因為我是使用node + react開發,融合的時候還稍微摸索了一下,想說或許在文件裡可以增加react使用的說明,方便其他人使用。內容如果有不合適的地方再請你隨意修改,謝謝。

// 以下為Component範例。直接使用也可以。

import React, { Component } from 'react';

// 此為引入,不需要再使用<script></script>引入
import TwCitySelector from 'your/path/node_modules/tw-city-selector/tw-city-selector';

class CitySelector extends Component {
  componentDidMount() {
    new TwCitySelector({
      el: '.my-selector-c',
      elCounty: '.county', // 在 el 裡查找 dom
      elDistrict: '.district', // 在 el 裡查找 dom
      elZipcode: '.zipcode', // 在 el 裡查找 dom
    });
  }

  // 在render()參考「js 實例方式加載」增加相對應element即可
  render () {
    return (
      <div class="my-selector-c">
        <div>
          <select class="county"></select>
        </div>
        <div>
          <select class="district"></select>
        </div>
        <div>
          <input type="text" class="zipcode">
        </div>
      </div>
    );
  }
}

export default CitySelector;

請問如何帶值進去?

假設原本有值(編輯個人資料)
我要讓他預設「selected」好讓我提交可以帶他的值進去

用ie開啟網頁時會有錯誤

您好,感謝您的程式
一直以來都用chrome作主要的瀏覽器
現在系統在作上線的的測試
發現用IE(11)開啟時會出錯誤
同樣的問題亦出現在github的說明頁裡
https://dennykuo.github.io/tw-city-selector/#/

顯示 物件沒有支援這個屬性或方法 'includes'
大概位在:
function setStandardWords
裡的
if (county.includes(str))
return county.replace(str, newStr);
return county;

不知是否可抽空修正或是提供修正方式?
感謝您

William

[建議] 依據中華郵政資料全面更新

建議依據中華郵政官方資料更新,細項如下:

  • 彰化縣 '員林鎮' 應修正為 '員林市'
  • 移除 '南海諸島', '釣魚台列嶼',已不符合使用現況
  • '釣魚臺' 依照中華郵政資料應歸屬於為 '宜蘭縣'
  • '東沙群島' 及 '南沙群島' 應歸屬於 '高雄市'
  • '屏東縣' '三地門' 應修正為 '三地門鄉'

請教下 tw-city-selector

想請教下
關於您所製作的tw-city-selector
全部都透過 div包住了
那要取得使用者點選完的select 的數值要如何取得呢?
感謝您

請問如何正確SET Value呢

你好,請問如何正確的SET Value呢??
我用以下方是將county設定上去,設定完成但district卻沒辦法正確顯示
$('.county-select').find("select[name='county']").val(county).change();

無法取得district的值

var districtSelect = document.getElementById("district"); districtSelect.addEventListener("change", function () { let selectedDistrictIndex = districtSelect.selectedIndex; console.log(selectedDistrictIndex); console.log(document.getElementsByTagName("option")[selectedDistrictIndex].text); }, false);
他會取到county的值

vue3 沒辦法即時響應值

我在使用變數綁定data-value時,用api的回傳把值替換掉,畫面不會跟著響應data-value改變後的值,我嘗試將值帶入select綁定的v-model,區域不會顯示帶入的值

使用指定選單ele寫法時,zipcode不會被trigger

大大你好:
我在使用時發現,一定要將hasZipCode設定為true才能讓zipcode被觸發產生,
好像有看到一段source code是el 跟hasZipCode 擇一都可以,但後來就找不到了,
不過範例裡面是沒有設定hasZipCod的 , 卻是不能work,能否再麻煩大大看看?
感謝!

    new TwCitySelector({
            el: '.city-selector-set',
            elCounty: '.county',
            elDistrict: '.district', 
            elZipcode: '.zipcode', 
            hasZipcode: true // Must Have
        });

排除特定縣市

非常感謝這個專案,請問是否有排除特定縣市與鄉鎮的方式呢?

有看到 #11 相關的討論,不知道這個功能是否已經實現了呢?

getCountyOptions is not defined

src/tw-city-selector line #157 #203 有使用 getCountyOptions 但沒有定義。
應是 line #208 function getCountryOptions,應改正為 getCountyOptions

請問如果要多個時怎麼做?

選擇縣市,選擇區域

假設我要兩份同樣的在同一個頁面上能怎麼實現?
我發現我把它分開之後

var c1 = new TwCitySelector({
        el: ".my-selector-c",
        elCounty: ".county",
        elDistrict: ".district"
      });
      var c2 = new TwCitySelector({
        el: ".my-selector-cc",
        elCounty: ".county_invoice",
        elDistrict: ".district_invoice"
      });

他兩塊選單的input名字都會是 name="county" 和 district name="district"

縣市選單錯誤修正

你好,很感謝提供這個工具!

注意到在高雄市中,鳳山應是區而不是市,可以協助修正這個錯誤嗎?

謝謝!

無法增加css

<script src="js/tw-city-selector/tw-city-selector.min.js"></script> <script type="text/javascript"> $select_a = new TwCitySelector({ el: ".pay", css: ["", "hide", "hide"], // <==== 無效 }); </script>

countyFiledName or countyFieldName?

In options of this plugin, we call district field name as districtFieldName and zip code field name zipcodeFieldName , but call country field name as countyFiledName? Isn't it a typo?

關於郵遞區號

如果選了縣市, 再選了區域, 然後再把區域選擇 "選擇區域"
那麼郵遞區號會顯示 "undefined"
如果顯示成空白會不會比較好一點呢 ?

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.